<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script id="versionArea" type="text/javascript">
//<![CDATA[
var version = {title: "TiddlyWiki", major: 2, minor: 6, revision: 2, date: new Date("Jan 6, 2011"), extensions: {}};
//]]>
</script>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="copyright" content="
TiddlyWiki created by Jeremy Ruston, (jeremy [at] osmosoft [dot] com)

Copyright (c) Jeremy Ruston 2004-2007
Copyright (c) UnaMesa Association 2007-2011

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

Neither the name of the UnaMesa Association nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
" />
<!--PRE-HEAD-START-->
<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
<!--PRE-HEAD-END-->
<title>
tw-wnb - Your work notes using TiddlyWiki
</title>
<style id="styleArea" type="text/css">
#saveTest {display:none;}
#messageArea {display:none;}
#copyright {display:none;}
#storeArea {display:none;}
#storeArea div {padding:0.5em; margin:1em 0em 0em 0em; border-color:#fff #666 #444 #ddd; border-style:solid; border-width:2px; overflow:auto;}
#shadowArea {display:none;}
#javascriptWarning {width:100%; text-align:center; font-weight:bold; background-color:#dd1100; color:#fff; padding:1em 0em;}
</style>
<!--POST-HEAD-START-->
<!--POST-HEAD-END-->
</head>
<body onload="main();" onunload="if(window.unload) unload();">
<!--PRE-BODY-START-->
<!--PRE-BODY-END-->
<div id="copyright">
Welcome to TiddlyWiki created by Jeremy Ruston; Copyright &copy; 2004-2007 Jeremy Ruston, Copyright &copy; 2007-2011 UnaMesa Association
</div>
<noscript>
</noscript>
<div id="saveTest"></div>
<div id="backstageCloak"></div>
<div id="backstageButton"></div>
<div id="backstageArea"><div id="backstageToolbar"></div></div>
<div id="backstage">
	<div id="backstagePanel"></div>
</div>
<div id="contentWrapper"></div>
<div id="contentStash"></div>
<div id="shadowArea">
<div title="MarkupPreHead">
<pre>&lt;!--{{{--&gt;
&lt;link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' /&gt;
&lt;!--}}}--&gt;
</pre>
</div>
<div title="ColorPalette">
<pre>Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
</pre>
</div>
<div title="StyleSheetColors">
<pre>/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity=60)';}
/*}}}*/</pre>
</div>
<div title="StyleSheetLayout">
<pre>/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
</pre>
</div>
<div title="StyleSheetLocale">
<pre>/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/</pre>
</div>
<div title="StyleSheetPrint">
<pre>/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/</pre>
</div>
<div title="PageTemplate">
<pre>&lt;!--{{{--&gt;
&lt;div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'&gt;
&lt;div class='headerShadow'&gt;
&lt;span class='siteTitle' refresh='content' tiddler='SiteTitle'&gt;&lt;/span&gt;&amp;nbsp;
&lt;span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class='headerForeground'&gt;
&lt;span class='siteTitle' refresh='content' tiddler='SiteTitle'&gt;&lt;/span&gt;&amp;nbsp;
&lt;span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id='mainMenu' refresh='content' tiddler='MainMenu'&gt;&lt;/div&gt;
&lt;div id='sidebar'&gt;
&lt;div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'&gt;&lt;/div&gt;
&lt;div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id='displayArea'&gt;
&lt;div id='messageArea'&gt;&lt;/div&gt;
&lt;div id='tiddlerDisplay'&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="ViewTemplate">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;)&lt;/div&gt;
&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;
&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="EditTemplate">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit title'&gt;&lt;/div&gt;
&lt;div macro='annotations'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;&lt;span macro='tagChooser excludeLists'&gt;&lt;/span&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="GettingStarted">
<pre>To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] &amp; [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: &lt;&lt;option txtUserName&gt;&gt;</pre>
</div>
<div title="OptionsPanel">
<pre>These [[InterfaceOptions]] for customising [[TiddlyWiki]] are saved in your browser

Your username for signing your edits. Write it as a [[WikiWord]] (eg [[JoeBloggs]])

&lt;&lt;option txtUserName&gt;&gt;
&lt;&lt;option chkSaveBackups&gt;&gt; [[SaveBackups]]
&lt;&lt;option chkAutoSave&gt;&gt; [[AutoSave]]
&lt;&lt;option chkRegExpSearch&gt;&gt; [[RegExpSearch]]
&lt;&lt;option chkCaseSensitiveSearch&gt;&gt; [[CaseSensitiveSearch]]
&lt;&lt;option chkAnimate&gt;&gt; [[EnableAnimations]]

----
Also see [[AdvancedOptions]]</pre>
</div>
<div title="ImportTiddlers">
<pre>&lt;&lt;importTiddlers&gt;&gt;</pre>
</div>
</div>
<!--POST-SHADOWAREA-->
<div id="storeArea">
<div title="AdvancedOptionsPlugin" modifier="escdie" created="201010171918" modified="201011101808" tags="systemConfig plugin %tw-elnb">
<pre>/***
|Name|AdvancedOptionsPlugin|
|Source|http://www.TiddlyTools.com/#AdvancedOptionsPlugin|
|Documentation|http://www.TiddlyTools.com/#AdvancedOptionsPlugin|
|Version|1.2.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.3|
|Type|plugin|
|Description|automatically add plugin-defined options to the [[AdvancedOptions]] shadow tiddler|
!!!!!Usage
&lt;&lt;&lt;
At document startup, this plugin examines each tiddler tagged with &lt;&lt;tag systemConfig&gt;&gt; and looks for a tiddler slice named &quot;Options&quot; whose value refers to a tiddler section (or separate tiddler) that contains an 'advanced options control panel' for configuring that plugin's features and behavior.  For each plugin that contains an &quot;Options&quot; slice, a tabbed entry is automatically created in the [[AdvancedOptions]] shadow tiddler to display that plugin's control panel.

As an optional fallback for backward-compatibility with plugin tiddlers that do not define the &quot;Options&quot; slice, this plugin will also look for a section heading named &quot;Configuration&quot; within those tiddlers, so that older plugins that define this section can automatically have their settings added to the [[AdvancedOptions]] tiddler without requiring the &quot;Options&quot; slice to be added.

This plugin also extends the standard {{{&lt;&lt;option&gt;&gt;}}} macro syntax so you can directly set the internal value of a boolean or text option, without displaying a corresponding checkbox or input field control simply by appending {{{=value}}} syntax to the end of the option ID parameter:
{{{
&lt;&lt;option &quot;txtSomeOption=some text&quot;&gt;&gt;
&lt;&lt;option chkSomeOtherOption=true&gt;&gt; OR &lt;&lt;option chkSomeOtherOption=false&gt;&gt;
}}}
Example: {{{&lt;&lt;option chkAnimate=false&gt;&gt;}}}
&lt;&lt;&lt;
!!!!!Configuration
&lt;&lt;&lt;
&lt;&lt;option chkAdvancedOptions&gt;&gt; automatically add plugin-defined options to the [[AdvancedOptions]] shadow tiddler
&lt;&lt;option chkAdvancedOptionsBackstage&gt;&gt; automatically add plugin-defined options to Backstage menu
&lt;&lt;option chkAdvancedOptionsFallback&gt;&gt; use &lt;&lt;option txtAdvancedOptionsFallback&gt;&gt; section as a fallback for plugins that don't define an ~AdvancedOptions slice
//note: these settings only take effect after reloading the document//
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.07.23 [1.2.0] added support for enhanced {{{&lt;&lt;option id=value&gt;&gt;}}} 'direct assignment' syntax
2008.05.09 [1.1.0] add &quot;options&quot; panel to backstage
2008.04.08 [1.0.0] initial release
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.AdvancedOptionsPlugin= {major: 1, minor: 2, revision: 0, date: new Date(2009,7,23)};

if (config.options.chkAdvancedOptions===undefined)
	config.options.chkAdvancedOptions=true;
if (config.options.chkAdvancedOptionsBackstage===undefined)
	config.options.chkAdvancedOptionsBackstage=true;
if (config.options.chkAdvancedOptionsFallback===undefined)
	config.options.chkAdvancedOptionsFallback=true;
if (config.options.txtAdvancedOptionsFallback===undefined)
	config.options.txtAdvancedOptionsFallback=&quot;Configuration&quot;;
if (config.optionsDesc) config.optionsDesc.chkAdvancedOptions=
	&quot;automatically add plugin-defined options to [[AdvancedOptions]]&quot;;
//}}}
//{{{
var items=[];
var fmt=&quot;[[%0 ]] [[view options for %0]] [[%1]]\n&quot;;
var section=config.options.txtAdvancedOptionsFallback;
var plugins=store.getTaggedTiddlers(&quot;systemConfig&quot;);
for (var p=0; p&lt;plugins.length; p++) {
	var tid=plugins[p].title;
	var settings=store.getTiddlerSlice(tid,&quot;Options&quot;);
	if (!settings &amp;&amp; config.options.chkAdvancedOptionsFallback &amp;&amp; store.getTiddlerText(tid+&quot;##&quot;+section))
		settings=&quot;##&quot;+section; // fallback handling for older plugins
	if (settings&amp;&amp;settings.length) {
		if (settings.substr(0,2)==&quot;##&quot;) settings=tid+settings;
		items.push(fmt.format([tid,settings]));
	}
}
if (items.length) config.shadowTiddlers.PluginOptions=
	&quot;!![[Plugin-defined options|PluginManager]]\n&gt;@@text-align:left;&lt;&lt;tabs '' \n&quot;+items.join(' ')+&quot;&gt;&gt;@@&quot;;
if (config.options.chkAdvancedOptions)
	config.shadowTiddlers.AdvancedOptions+=&quot;{{smallform{{{wrap{&lt;&lt;tiddler PluginOptions&gt;&gt;}}}}}}&quot;;
//}}}
//{{{
// // add &quot;options&quot; backstage task
if (config.tasks &amp;&amp; config.options.chkAdvancedOptionsBackstage) { // for TW2.2b3 or above
	config.tasks.options = {
		text: &quot;options&quot;,
		tooltip: &quot;manage plugin-defined option settings&quot;,
		content: &quot;{{smallform{{{groupbox{{{wrap{&lt;&lt;tiddler PluginOptions&gt;&gt;}}}}}}\n{{groupbox small {&lt;&lt;options&gt;&gt;}}}}}}&quot;
	}
	config.backstageTasks.splice(config.backstageTasks.indexOf(&quot;plugins&quot;)+1,0,&quot;options&quot;);
}
//}}}
//{{{
config.macros.option.AOPsave_handler=config.macros.option.handler;
config.macros.option.handler=function(place,macroName,params,wikifier,paramString,tiddler) {
	var parts=params[0].split('=');
	if (parts.length==1) return this.AOPsave_handler.apply(this,arguments);
	var id=parts[0]; var val=(id.substr(0,3)=='txt')?parts[1]:(parts[1]=='true');
	config.options[id]=val;
}
//}}}</pre>
</div>
<div title="AttachFilePlugin" modifier="dger" created="201010171523" modified="201010180706" tags="AttachFilePackage systemConfig %tw-elnb">
<pre>/***
|Name|AttachFilePlugin|
|Source|http://www.TiddlyTools.com/#AttachFilePlugin|
|Documentation|http://www.TiddlyTools.com/#AttachFilePluginInfo|
|Version|4.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires|AttachFilePluginFormatters, AttachFileMIMETypes|
|Description|Store binary files as base64-encoded tiddlers with fallback links for separate local and/or remote file storage|
Store or link binary files (such as jpg, gif, pdf or even mp3) within your TiddlyWiki document and then use them as images or links from within your tiddler content.
&gt; Important note: As of version 3.6.0, in order to //render// images and other binary attachments created with this plugin, you must also install [[AttachFilePluginFormatters]], which extends the behavior of the TiddlyWiki core formatters for embedded images ({{{[img[tooltip|image]]}}}), linked embedded images ({{{[img[tooltip|image][link]]}}}), and external/&quot;pretty&quot; links ({{{[[label|link]]}}}), so that these formatter will process references to attachment tiddlers as if a normal file reference had been provided. |
!!!!!Documentation
&gt;see [[AttachFilePluginInfo]]
!!!!!Inline interface (live)
&gt;see [[AttachFile]] (shadow tiddler)
&gt;&lt;&lt;tiddler AttachFile&gt;&gt;
!!!!!Revisions
&lt;&lt;&lt;
2009.06.04 [4.0.0] changed attachment storage format to use //sections// instead of embedded substring markers.
|please see [[AttachFilePluginInfo]] for additional revision details|
2005.07.20 [1.0.0] Initial Release
&lt;&lt;&lt;
!!!!!Code
***/
// // version
//{{{
version.extensions.AttachFilePlugin= {major: 4, minor: 0, revision: 0, date: new Date(2009,6,4)};

// shadow tiddler
config.shadowTiddlers.AttachFile=&quot;&lt;&lt;attach inline&gt;&gt;&quot;;

// add 'attach' backstage task (insert before built-in 'importTask')
if (config.tasks) { // for TW2.2b or above
	config.tasks.attachTask = {
		text: &quot;attach&quot;,
		tooltip: &quot;Attach a binary file as a tiddler&quot;,
		content: &quot;&lt;&lt;attach inline&gt;&gt;&quot;
	}
	config.backstageTasks.splice(config.backstageTasks.indexOf(&quot;importTask&quot;),0,&quot;attachTask&quot;);
}

config.macros.attach = {
// // lingo
//{{{
	label: &quot;attach file&quot;,
	tooltip: &quot;Attach a file to this document&quot;,
	linkTooltip: &quot;Attachment: &quot;,

	typeList: &quot;AttachFileMIMETypes&quot;,

	titlePrompt: &quot; enter tiddler title...&quot;,
	MIMEPrompt: &quot;&lt;option value=''&gt;select MIME type...&lt;/option&gt;&lt;option value='editlist'&gt;[edit list...]&lt;/option&gt;&quot;,
	localPrompt: &quot; enter local path/filename...&quot;,
	URLPrompt: &quot; enter remote URL...&quot;,

	tiddlerErr: &quot;Please enter a tiddler title&quot;,
	sourceErr: &quot;Please enter a source path/filename&quot;,
	storageErr: &quot;Please select a storage method: embedded, local or remote&quot;,
	MIMEErr: &quot;Unrecognized file format.  Please select a MIME type&quot;,
	localErr: &quot;Please enter a local path/filename&quot;,
	URLErr: &quot;Please enter a remote URL&quot;,
	fileErr: &quot;Invalid path/file or file not found&quot;,

	tiddlerFormat: '!usage\n{{{%0}}}\n%0\n!notes\n%1\n!type\n%2\n!file\n%3\n!url\n%4\n!data\n%5\n',

//}}}
// // macro definition
//{{{
	handler:
	function(place,macroName,params) {
		if (params &amp;&amp; !params[0])
			{ createTiddlyButton(place,this.label,this.tooltip,this.toggleAttachPanel); return; }
		var id=params.shift();
		this.createAttachPanel(place,id+&quot;_attachPanel&quot;,params);
		document.getElementById(id+&quot;_attachPanel&quot;).style.position=&quot;static&quot;;
		document.getElementById(id+&quot;_attachPanel&quot;).style.display=&quot;block&quot;;
	},
//}}}
//{{{
	createAttachPanel:
	function(place,panel_id,params) {
		if (!panel_id || !panel_id.length) var panel_id=&quot;_attachPanel&quot;;
		// remove existing panel (if any)
		var panel=document.getElementById(panel_id); if (panel) panel.parentNode.removeChild(panel);
		// set styles for this panel
		setStylesheet(this.css,&quot;attachPanel&quot;);
		// create new panel
		var title=&quot;&quot;; if (params &amp;&amp; params[0]) title=params.shift();
		var types=this.MIMEPrompt+this.formatListOptions(store.getTiddlerText(this.typeList)); // get MIME types
		panel=createTiddlyElement(place,&quot;span&quot;,panel_id,&quot;attachPanel&quot;,null);
		var html=this.html.replace(/%id%/g,panel_id);
		html=html.replace(/%title%/g,title);
		html=html.replace(/%disabled%/g,title.length?&quot;disabled&quot;:&quot;&quot;);
		html=html.replace(/%IEdisabled%/g,config.browser.isIE?&quot;disabled&quot;:&quot;&quot;);
		html=html.replace(/%types%/g,types);
		panel.innerHTML=html;
		if (config.browser.isGecko) { // FF3 FIXUP
			document.getElementById(&quot;attachSource&quot;).style.display=&quot;none&quot;;
			document.getElementById(&quot;attachFixPanel&quot;).style.display=&quot;block&quot;;
		}
		return panel;
	},
//}}}
//{{{
	toggleAttachPanel:
	function (e) {
		if (!e) var e = window.event;
		var parent=resolveTarget(e).parentNode;
		var panel = document.getElementById(&quot;_attachPanel&quot;);
		if (panel==undefined || panel.parentNode!=parent)
			panel=config.macros.attach.createAttachPanel(parent,&quot;_attachPanel&quot;);
		var isOpen = panel.style.display==&quot;block&quot;;
		if(config.options.chkAnimate)
			anim.startAnimating(new Slider(panel,!isOpen,e.shiftKey || e.altKey,&quot;none&quot;));
		else
			panel.style.display = isOpen ? &quot;none&quot; : &quot;block&quot; ;
		e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
		return(false);
	},
//}}}
//{{{
	formatListOptions:
	function(text) {
		if (!text || !text.trim().length) return &quot;&quot;;
		// get MIME list content from text
		var parts=text.split(&quot;\n----\n&quot;);
		var out=&quot;&quot;;
		for (var p=0; p&lt;parts.length; p++) {
			var lines=parts[p].split(&quot;\n&quot;);
			var label=lines.shift(); // 1st line=display text
			var value=lines.shift(); // 2nd line=item value
			out +='&lt;option value=&quot;%1&quot;&gt;%0&lt;/option&gt;'.format([label,value]);
		}
		return out;
	},
//}}}
// // interface definition
//{{{
	css:
	&quot;.attachPanel { display: none; position:absolute; z-index:10; width:35em; right:105%; top:0em;\
		background-color: #eee; color:#000; font-size: 8pt; line-height:110%;\
		border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;\
		padding: 0.5em; margin:0em; -moz-border-radius:1em;-webkit-border-radius:1em; text-align:left }\
	.attachPanel form { display:inline;border:0;padding:0;margin:0; }\
	.attachPanel select { width:99%;margin:0px;font-size:8pt;line-height:110%;}\
	.attachPanel input  { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\
	.attachPanel textarea { width:98%;margin:0px;height:2em;font-size:8pt;line-height:110%}\
	.attachPanel table { width:100%;border:0;margin:0;padding:0;color:inherit; }\
	.attachPanel tbody, .attachPanel tr, .attachPanel td { border:0;margin:0;padding:0;color:#000; }\
	.attachPanel .box { border:1px solid black; padding:.3em; margin:.3em 0px; background:#f8f8f8; \
		-moz-border-radius:5px;-webkit-border-radius:5px; }\
	.attachPanel .chk { width:auto;border:0; }\
	.attachPanel .btn { width:auto; }\
	.attachPanel .btn2 { width:49%; }\
	&quot;,
//}}}
//{{{
	html:
	'&lt;form&gt;\
		attach from source file\
		&lt;input type=&quot;file&quot; id=&quot;attachSource&quot; name=&quot;source&quot; size=&quot;56&quot;\
			onChange=&quot;config.macros.attach.onChangeSource(this)&quot;&gt;\
		&lt;div id=&quot;attachFixPanel&quot; style=&quot;display:none&quot;&gt;&lt;!-- FF3 FIXUP --&gt;\
			&lt;input type=&quot;text&quot; id=&quot;attachFixSource&quot; style=&quot;width:90%&quot;\
				title=&quot;Enter a path/file to attach&quot;\
				onChange=&quot;config.macros.attach.onChangeSource(this);&quot;&gt;\
			&lt;input type=&quot;button&quot; style=&quot;width:7%&quot; value=&quot;...&quot;\
				title=&quot;Enter a path/file to attach&quot;\
				onClick=&quot;config.macros.attach.askForFilename(document.getElementById(\'attachFixSource\'));&quot;&gt;\
		&lt;/div&gt;&lt;!--end FF3 FIXUP--&gt;\
		&lt;div class=&quot;box&quot;&gt;\
		&lt;table style=&quot;border:0&quot;&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			embed data &lt;input type=checkbox class=chk name=&quot;useData&quot; %IEdisabled% \
				onclick=&quot;if (!this.form.MIMEType.value.length)\
					this.form.MIMEType.selectedIndex=this.checked?1:0; &quot;&gt;&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot;&gt;\
			&lt;select size=1 name=&quot;MIMEType&quot; \
				onchange=&quot;this.title=this.value; if (this.value==\'editlist\')\
					{ this.selectedIndex=this.form.useData.checked?1:0; story.displayTiddler(null,config.macros.attach.typeList,2); return; }&quot;&gt;\
				&lt;option value=&quot;&quot;&gt;&lt;/option&gt;\
				%types%\
			&lt;/select&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			local link &lt;input type=checkbox class=chk name=&quot;useLocal&quot;\
				onclick=&quot;this.form.local.value=this.form.local.defaultValue=this.checked?config.macros.attach.localPrompt:\'\';&quot;&gt;&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot;&gt;\
			&lt;input type=text name=&quot;local&quot; size=15 autocomplete=off value=&quot;&quot;\
				onchange=&quot;this.form.useLocal.checked=this.value.length&quot; \
				onkeyup=&quot;this.form.useLocal.checked=this.value.length&quot; \
				onfocus=&quot;if (!this.value.length) this.value=config.macros.attach.localPrompt; this.select()&quot;&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			remote link &lt;input type=checkbox class=chk name=&quot;useURL&quot;\
				onclick=&quot;this.form.URL.value=this.form.URL.defaultValue=this.checked?config.macros.attach.URLPrompt:\'\';\&quot;&gt;&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot;&gt;\
			&lt;input type=text name=&quot;URL&quot; size=15 autocomplete=off value=&quot;&quot;\
				onfocus=&quot;if (!this.value.length) this.value=config.macros.attach.URLPrompt; this.select()&quot;\
				onchange=&quot;this.form.useURL.checked=this.value.length;&quot;\
				onkeyup=&quot;this.form.useURL.checked=this.value.length;&quot;&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;\
		&lt;/div&gt;\
		&lt;table style=&quot;border:0&quot;&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;vertical-align:top;width:1%;white-space:nowrap&quot;&gt;\
			notes&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot; colspan=2&gt;\
			&lt;textarea name=&quot;notes&quot; style=&quot;width:98%;height:3.5em;margin-bottom:2px&quot;&gt;&lt;/textarea&gt;\
		&lt;/td&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			attach as&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot; colspan=2&gt;\
			&lt;input type=text name=&quot;tiddlertitle&quot; size=15 autocomplete=off value=&quot;%title%&quot;\
				onkeyup=&quot;if (!this.value.length) { this.value=config.macros.attach.titlePrompt; this.select(); }&quot;\
				onfocus=&quot;if (!this.value.length) this.value=config.macros.attach.titlePrompt; this.select()&quot; %disabled%&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;/tr&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			add tags&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot;&gt;\
			&lt;input type=text name=&quot;tags&quot; size=15 autocomplete=off value=&quot;&quot; onfocus=&quot;this.select()&quot;&gt;\
		&lt;/td&gt;&lt;td style=&quot;width:40%;text-align:right;border:0&quot;&gt;\
			&lt;input type=button class=btn2 value=&quot;attach&quot;\
				onclick=&quot;config.macros.attach.onClickAttach(this)&quot;&gt;&lt;!--\
			--&gt;&lt;input type=button class=btn2 value=&quot;close&quot;\
				onclick=&quot;var panel=document.getElementById(\'%id%\'); if (panel) panel.parentNode.removeChild(panel);&quot;&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;\
	&lt;/form&gt;',
//}}}
// // control processing
//{{{
	onChangeSource:
	function(here) {
		var form=here.form;
		var list=form.MIMEType;
		var theFilename  = here.value;
		var theExtension = theFilename.substr(theFilename.lastIndexOf('.')).toLowerCase();
		// if theFilename is in current document folder, remove path prefix and use relative reference
		var h=document.location.href; folder=getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf(&quot;/&quot;)+1)));
		if (theFilename.substr(0,folder.length)==folder) theFilename='./'+theFilename.substr(folder.length);
		else theFilename='file:///'+theFilename; // otherwise, use absolute reference
		theFilename=theFilename.replace(/\\/g,&quot;/&quot;); // fixup: change \ to /
		form.useLocal.checked = true;
		form.local.value = theFilename;
		form.useData.checked = !form.useData.disabled;
		list.selectedIndex=1;
		for (var i=0; i&lt;list.options.length; i++) // find matching MIME type
			if (list.options[i].value.indexOf(theExtension)!=-1) { list.selectedIndex = i; break; }
		if (!form.tiddlertitle.disabled)
			form.tiddlertitle.value=theFilename.substr(theFilename.lastIndexOf('/')+1); // get tiddlername from filename
	},
//}}}
//{{{
	onClickAttach:
	function (here) {
		clearMessage();
		// get input values
		var form=here.form;
		var src=form.source; if (config.browser.isGecko) src=document.getElementById(&quot;attachFixSource&quot;);
		src=src.value!=src.defaultValue?src.value:&quot;&quot;;
		var when=(new Date()).formatString(config.macros.timeline.dateFormat);
		var title=form.tiddlertitle.value;
		var local = form.local.value!=form.local.defaultValue?form.local.value:&quot;&quot;;
		var url = form.URL.value!=form.URL.defaultValue?form.URL.value:&quot;&quot;;
		var notes = form.notes.value;
		var tags = &quot;@attachment excludeMissing &quot;+form.tags.value;
		var useData=form.useData.checked;
		var useLocal=form.useLocal.checked;
		var useURL=form.useURL.checked;
		var mimetype = form.MIMEType.value.length?form.MIMEType.options[form.MIMEType.selectedIndex].text:&quot;&quot;;
		// validate checkboxes and get filename
		if (useData) {
			if (src.length) { if (!theLocation) var theLocation=src; }
			else { alert(this.sourceErr); src.focus(); return false; }
		}
		if (useLocal) {
			if (local.length) { if (!theLocation) var theLocation = local; }
			else { alert(this.localErr); form.local.focus(); return false; }
		}
		if (useURL) {
			if (url.length) { if (!theLocation) var theLocation = url; }
			else { alert(this.URLErr); form.URL.focus(); return false; }
		}
		if (!(useData||useLocal||useURL))
			{ form.useData.focus(); alert(this.storageErr); return false; }
		if (!theLocation)
			{ src.focus(); alert(this.sourceErr); return false; }
		if (!title || !title.trim().length || title==this.titlePrompt)
			{ form.tiddlertitle.focus(); alert(this.tiddlerErr); return false; }
		// if not already selected, determine MIME type based on filename extension (if any)
		if (useData &amp;&amp; !mimetype.length &amp;&amp; theLocation.lastIndexOf('.')!=-1) {
			var theExt = theLocation.substr(theLocation.lastIndexOf('.')).toLowerCase();
			var theList=form.MIMEType;
			for (var i=0; i&lt;theList.options.length; i++)
				if (theList.options[i].value.indexOf(theExt)!=-1)
					{ var mimetype=theList.options[i].text; theList.selectedIndex=i; break; }
		}
		// attach the file
		return this.createAttachmentTiddler(src, when, notes, tags, title,
			useData, useLocal, useURL, local, url, mimetype);
	},
	getMIMEType:
	function(src,def) {
		var ext = src.substr(src.lastIndexOf('.')).toLowerCase();
		var list=store.getTiddlerText(this.typeList);
		if (!list || !list.trim().length) return def;
		// get MIME list content from tiddler
		var parts=list.split(&quot;\n----\n&quot;);
		for (var p=0; p&lt;parts.length; p++) {
			var lines=parts[p].split(&quot;\n&quot;);
			var mime=lines.shift(); // 1st line=MIME type
			var match=lines.shift(); // 2nd line=matching extensions
			if (match.indexOf(ext)!=-1) return mime;
		}
		return def;
	},
	createAttachmentTiddler:
	function (src, when, notes, tags, title, useData, useLocal, useURL, local, url, mimetype, noshow) {
		if (useData) { // encode the data
			if (!mimetype.length) {
				alert(this.MIMEErr);
				form.MIMEType.selectedIndex=1; form.MIMEType.focus();
				return false;
			}
			var d = this.readFile(src); if (!d) { return false; }
			displayMessage('encoding '+src);
			var encoded = this.encodeBase64(d);
			displayMessage('file size='+d.length+' bytes, encoded size='+encoded.length+' bytes');
		}
		var usage=(mimetype.substr(0,5)==&quot;image&quot;?'[img[%0]]':'[[%0|%0]]').format([title]);
		var theText=this.tiddlerFormat.format([
			usage, notes.length?notes:'//none//', mimetype,
			useLocal?local.replace(/\\/g,'/'):'', useURL?url:'',
			useData?('data:'+mimetype+';base64,'+encoded):'' ]);
		store.saveTiddler(title,title,theText,config.options.txtUserName,new Date(),tags);
		var panel=document.getElementById(&quot;attachPanel&quot;); if (panel) panel.style.display=&quot;none&quot;;
		if (!noshow) { story.displayTiddler(null,title); story.refreshTiddler(title,null,true); }
		displayMessage('attached &quot;'+title+'&quot;');
		return true;
	},
//}}}
// // base64 conversion
//{{{
	encodeBase64:
	function (d) {
		if (!d) return null;
		// encode as base64
		var keyStr = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=&quot;;
		var out=&quot;&quot;;
		var chr1,chr2,chr3=&quot;&quot;;
		var enc1,enc2,enc3,enc4=&quot;&quot;;
		for (var count=0,i=0; i&lt;d.length; ) {
			chr1=d.charCodeAt(i++);
			chr2=d.charCodeAt(i++);
			chr3=d.charCodeAt(i++);
			enc1=chr1 &gt;&gt; 2;
			enc2=((chr1 &amp; 3) &lt;&lt; 4) | (chr2 &gt;&gt; 4);
			enc3=((chr2 &amp; 15) &lt;&lt; 2) | (chr3 &gt;&gt; 6);
			enc4=chr3 &amp; 63;
			if (isNaN(chr2)) enc3=enc4=64;
			else if (isNaN(chr3)) enc4=64;
			out+=keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);
			chr1=chr2=chr3=enc1=enc2=enc3=enc4=&quot;&quot;;
		}
		return out;
	},
	decodeBase64: function(input) {
		var out=&quot;&quot;;
		var chr1,chr2,chr3;
		var enc1,enc2,enc3,enc4;
		var i = 0;
		// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
		input=input.replace(/[^A-Za-z0-9\+\/\=]/g, &quot;&quot;);
		do {
			enc1=keyStr.indexOf(input.charAt(i++));
			enc2=keyStr.indexOf(input.charAt(i++));
			enc3=keyStr.indexOf(input.charAt(i++));
			enc4=keyStr.indexOf(input.charAt(i++));
			chr1=(enc1 &lt;&lt; 2) | (enc2 &gt;&gt; 4);
			chr2=((enc2 &amp; 15) &lt;&lt; 4) | (enc3 &gt;&gt; 2);
			chr3=((enc3 &amp; 3) &lt;&lt; 6) | enc4;
			out=out+String.fromCharCode(chr1);
			if (enc3!=64) out=out+String.fromCharCode(chr2);
			if (enc4!=64) out=out+String.fromCharCode(chr3);
		} while (i&lt;input.length);
		return out;
	},
//}}}
// // I/O functions
//{{{
	readFile: // read local BINARY file data
	function(filePath) {
		if(!window.Components) { return null; }
		try { netscape.security.PrivilegeManager.enablePrivilege(&quot;UniversalXPConnect&quot;); }
		catch(e) { alert(&quot;access denied: &quot;+filePath); return null; }
		var file = Components.classes[&quot;@mozilla.org/file/local;1&quot;].createInstance(Components.interfaces.nsILocalFile);
		try { file.initWithPath(filePath); } catch(e) { alert(&quot;cannot read file - invalid path: &quot;+filePath); return null; }
		if (!file.exists()) { alert(&quot;cannot read file - not found: &quot;+filePath); return null; }
		var inputStream = Components.classes[&quot;@mozilla.org/network/file-input-stream;1&quot;].createInstance(Components.interfaces.nsIFileInputStream);
		inputStream.init(file, 0x01, 00004, null);
		var bInputStream = Components.classes[&quot;@mozilla.org/binaryinputstream;1&quot;].createInstance(Components.interfaces.nsIBinaryInputStream);
		bInputStream.setInputStream(inputStream);
		return(bInputStream.readBytes(inputStream.available()));
	},
//}}}
//{{{
	writeFile:
	function(filepath,data) {
		// TBD: decode base64 and write BINARY data to specified local path/filename
		return(false);
	},
//}}}
//{{{
	askForFilename: // for FF3 fixup
	function(target) {
		var msg=config.messages.selectFile;
		if (target &amp;&amp; target.title) msg=target.title; // use target field tooltip (if any) as dialog prompt text
		// get local path for current document
		var path=getLocalPath(document.location.href);
		var p=path.lastIndexOf(&quot;/&quot;); if (p==-1) p=path.lastIndexOf(&quot;\\&quot;); // Unix or Windows
		if (p!=-1) path=path.substr(0,p+1); // remove filename, leave trailing slash
		var file=&quot;&quot;
		var result=window.mozAskForFilename(msg,path,file,true); // FF3 FIXUP ONLY
		if (target &amp;&amp; result.length) // set target field and trigger handling
			{ target.value=result; target.onchange(); }
		return result; 
	}
};
//}}}
//{{{
if (window.mozAskForFilename===undefined) { // also defined by CoreTweaks (for ticket #604)
	window.mozAskForFilename=function(msg,path,file,mustExist) {
		if(!window.Components) return false;
		try {
			netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
			var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
			var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
			picker.init(window, msg, mustExist?nsIFilePicker.modeOpen:nsIFilePicker.modeSave);
			var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
			thispath.initWithPath(path);
			picker.displayDirectory=thispath;
			picker.defaultExtension='';
			picker.defaultString=file;
			picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
			if (picker.show()!=nsIFilePicker.returnCancel)
				var result=picker.file.persistentDescriptor;
		}
		catch(ex) { displayMessage(ex.toString()); }
		return result;
	}
}
//}}}</pre>
</div>
<div title="AttachFilePluginFormatters" modifier="escdie" created="201010171528" modified="201011101808" tags="AttachFilePackage systemConfig %tw-elnb">
<pre>/***
|Name|AttachFilePluginFormatters|
|Source|http://www.TiddlyTools.com/#AttachFilePluginFormatters|
|Version|4.0.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1.3|
|Type|plugin|
|Description|run-time library for displaying attachment tiddlers|
Runtime processing for //rendering// attachment tiddlers created by [[AttachFilePlugin]].   Attachment tiddlers are tagged with&lt;&lt;tag @attachment&gt;&gt;and contain binary file content (e.g., jpg, gif, pdf, mp3, etc.) that has been stored directly as base64 text-encoded data or can be loaded from external files stored on a local filesystem or remote web server.  Note: after creating new attachment tiddlers, you can remove [[AttachFilePlugin]], as long as you retain //this// tiddler (so that images can be rendered later on).
!!!!!Formatters
&lt;&lt;&lt;
This plugin extends the behavior of the following TiddlyWiki core &quot;wikify()&quot; formatters:
* embedded images: {{{[img[tooltip|image]]}}}
* linked embedded images: {{{[img[tooltip|image][link]]}}}
* external/&quot;pretty&quot; links: {{{[[label|link]]}}}
''Please refer to AttachFilePlugin (source: http://www.TiddlyTools.com/#AttachFilePlugin) for additional information.''
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.10.10 [4.0.1] in fileExists(), check for IE to avoid hanging Chrome during startup
2009.06.04 [4.0.0] changed attachment storage format to use //sections// instead of embedded substring markers.
2008.01.08 [*.*.*] plugin size reduction: documentation moved to ...Info
2007.12.04 [*.*.*] update for TW2.3.0: replaced deprecated core functions, regexps, and macros
2007.10.29 [3.7.0] more code reduction: removed upload handling from AttachFilePlugin (saves ~7K!)
2007.10.28 [3.6.0] removed duplicate formatter code from AttachFilePlugin (saves ~10K!) and updated documentation accordingly.  This plugin ([[AttachFilePluginFormatters]]) is now //''required''// in order to display attached images/binary files within tiddler content.
2006.05.20 [3.4.0] through 2007.03.01 [3.5.3] sync with AttachFilePlugin
2006.05.13 [3.2.0] created from AttachFilePlugin v3.2.0
&lt;&lt;&lt;
!!!!!Code
***/
// // version
//{{{
version.extensions.AttachFilePluginFormatters= {major: 4, minor: 0, revision: 1, date: new Date(2009,10,10)};
//}}}

//{{{
if (config.macros.attach==undefined) config.macros.attach= { };
//}}}
//{{{
if (config.macros.attach.isAttachment==undefined) config.macros.attach.isAttachment=function (title) {
	var tiddler = store.getTiddler(title);
	if (tiddler==undefined || tiddler.tags==undefined) return false;
	return (tiddler.tags.indexOf(&quot;@attachment&quot;)!=-1);
}
//}}}

//{{{
// test for local file existence - returns true/false without visible error display
if (config.macros.attach.fileExists==undefined) config.macros.attach.fileExists=function(f) {
	if(window.Components) { // MOZ
		try { netscape.security.PrivilegeManager.enablePrivilege(&quot;UniversalXPConnect&quot;); }
		catch(e) { return false; } // security access denied
		var file = Components.classes[&quot;@mozilla.org/file/local;1&quot;].createInstance(Components.interfaces.nsILocalFile);
		try { file.initWithPath(f); }
		catch(e) { return false; } // invalid directory
		return file.exists();
	}
	else if (config.browser.isIE) { // IE
		var fso = new ActiveXObject(&quot;Scripting.FileSystemObject&quot;);
		return fso.FileExists(f);
	}
	else return true; // other browsers: assume file exists
}
//}}}

//{{{
if (config.macros.attach.getAttachment==undefined) config.macros.attach.getAttachment=function(title) {

	// extract embedded data, local and remote links (if any)
	var text=store.getTiddlerText(title,'');
	var embedded=store.getTiddlerText(title+'##data','').trim();
	var locallink=store.getTiddlerText(title+'##file','').trim();
	var remotelink=store.getTiddlerText(title+'##url','').trim();

	// backward-compatibility for older attachments (pre 4.0.0)
	var startmarker=&quot;---BEGIN_DATA---\n&quot;;
	var endmarker=&quot;\n---END_DATA---&quot;;
	var pos=0; var endpos=0;
	if ((pos=text.indexOf(startmarker))!=-1 &amp;&amp; (endpos=text.indexOf(endmarker))!=-1)
		embedded=&quot;data:&quot;+(text.substring(pos+startmarker.length,endpos)).replace(/\n/g,'');
	if ((pos=text.indexOf(&quot;/%LOCAL_LINK%/&quot;))!=-1)
		locallink=text.substring(text.indexOf(&quot;|&quot;,pos)+1,text.indexOf(&quot;]]&quot;,pos));
	if ((pos=text.indexOf(&quot;/%REMOTE_LINK%/&quot;))!=-1)
		remotelink=text.substring(text.indexOf(&quot;|&quot;,pos)+1,text.indexOf(&quot;]]&quot;,pos));

	// if there is a data: URI defined (not supported by IE)
	if (embedded.length &amp;&amp; !config.browser.isIE) return embedded;

	// document is being served remotely... use remote URL (if any)  (avoids security alert)
	if (remotelink.length &amp;&amp; document.location.protocol!=&quot;file:&quot;)
		return remotelink;  

	// local link only... return link without checking file existence (avoids security alert)
	if (locallink.length &amp;&amp; !remotelink.length) 
		return locallink; 

	// local link, check for file exist... use local link if found
	if (locallink.length) { 
		locallink=locallink.replace(/^\.[\/\\]/,''); // strip leading './' or '.\' (if any)
		if (this.fileExists(getLocalPath(locallink))) return locallink;
		// maybe local link is relative... add path from current document and try again
		var pathPrefix=document.location.href;  // get current document path and trim off filename
		var slashpos=pathPrefix.lastIndexOf(&quot;/&quot;); if (slashpos==-1) slashpos=pathPrefix.lastIndexOf(&quot;\\&quot;); 
		if (slashpos!=-1 &amp;&amp; slashpos!=pathPrefix.length-1) pathPrefix=pathPrefix.substr(0,slashpos+1);
		if (this.fileExists(getLocalPath(pathPrefix+locallink))) return locallink;
	}

	// no embedded data, no local (or not found), fallback to remote URL (if any)
	if (remotelink.length) return remotelink;

	// attachment URL doesn't resolve, just return input as is
	return title;
}
//}}}
//{{{
if (config.macros.attach.init_formatters==undefined) config.macros.attach.init_formatters=function() {
	if (this.initialized) return;

	// find the formatter for &quot;image&quot; and replace the handler
	for (var i=0; i&lt;config.formatters.length &amp;&amp; config.formatters[i].name!=&quot;image&quot;; i++);
	if (i&lt;config.formatters.length)	config.formatters[i].handler=function(w) {
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
		if(lookaheadMatch &amp;&amp; lookaheadMatch.index == w.matchStart) // Simple bracketted link
			{
			var e = w.output;
			if(lookaheadMatch[5])
				{
				var link = lookaheadMatch[5];
				// ELS -------------
				var external=config.formatterHelpers.isExternalLink(link);
				if (external)
					{
					if (config.macros.attach.isAttachment(link))
						{
						e = createExternalLink(w.output,link);
						e.href=config.macros.attach.getAttachment(link);
						e.title = config.macros.attach.linkTooltip + link;
						}
					else
						e = createExternalLink(w.output,link);
					}
				else 
					e = createTiddlyLink(w.output,link,false,null,w.isStatic);
				// ELS -------------
				addClass(e,&quot;imageLink&quot;);
				}
			var img = createTiddlyElement(e,&quot;img&quot;);
			if(lookaheadMatch[1])
				img.align = &quot;left&quot;;
			else if(lookaheadMatch[2])
				img.align = &quot;right&quot;;
			if(lookaheadMatch[3])
				img.title = lookaheadMatch[3];
			img.src = lookaheadMatch[4];
			// ELS -------------
			if (config.macros.attach.isAttachment(lookaheadMatch[4]))
				img.src=config.macros.attach.getAttachment(lookaheadMatch[4]);
			// ELS -------------
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
//}}}
//{{{
	// find the formatter for &quot;prettyLink&quot; and replace the handler
	for (var i=0; i&lt;config.formatters.length &amp;&amp; config.formatters[i].name!=&quot;prettyLink&quot;; i++);
	if (i&lt;config.formatters.length)	{
		config.formatters[i].handler=function(w) {
			this.lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
			if(lookaheadMatch &amp;&amp; lookaheadMatch.index == w.matchStart) {
				var e;
				var text = lookaheadMatch[1];
				if(lookaheadMatch[3]) {
					// Pretty bracketted link
					var link = lookaheadMatch[3];
					if (config.macros.attach.isAttachment(link)) {
						e = createExternalLink(w.output,link);
						e.href=config.macros.attach.getAttachment(link);
						e.title=config.macros.attach.linkTooltip+link;
					}
					else e = (!lookaheadMatch[2] &amp;&amp; config.formatterHelpers.isExternalLink(link))
						? createExternalLink(w.output,link)
						: createTiddlyLink(w.output,link,false,null,w.isStatic);
				} else {
					e = createTiddlyLink(w.output,text,false,null,w.isStatic);
				}
				createTiddlyText(e,text);
				w.nextMatch = this.lookaheadRegExp.lastIndex;
			}
		}
	} // if &quot;prettyLink&quot; formatter found
	this.initialized=true;
}
//}}}
//{{{
config.macros.attach.init_formatters(); // load time init
//}}}
//{{{
if (TiddlyWiki.prototype.coreGetRecursiveTiddlerText==undefined) {
	TiddlyWiki.prototype.coreGetRecursiveTiddlerText = TiddlyWiki.prototype.getRecursiveTiddlerText;
	TiddlyWiki.prototype.getRecursiveTiddlerText = function(title,defaultText,depth) {
		return config.macros.attach.isAttachment(title)?
			config.macros.attach.getAttachment(title):this.coreGetRecursiveTiddlerText.apply(this,arguments);
	}
}
//}}}</pre>
</div>
<div title="AutoRefreshPlugin" modifier="dger" created="201007171122" modified="201009301853" tags="systemConfig plugin %tw-elnb">
<pre>/***
|''Name:''|AutoRefreshPlugin|
|''Version:''|1.0.1 (2007-01-20)|
|''Type:''|plugin|
|''Source:''|http://tiddlywiki.abego-software.de/#AutoRefreshPlugin|
|''Author:''|Udo Borkowski (ub [at] abego-software [dot] de)|
|''Documentation:''|[[AutoRefreshPlugin Documentation|http://tiddlywiki.abego-software.de/#%5B%5BAutoRefreshPlugin%20Documentation%5D%5D]]|
|''Licence:''|[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]|
|''~CoreVersion:''|2.1.3|
|''Browser:''|Firefox 1.5.0.9 or better; Internet Explorer 6.0|
A tiddler containing the {{{&lt;&lt;autoRefresh...&gt;&gt;}}} macro is automatically refreshed (re-painted) whenever a tiddler changes.
!Syntax
{{{
&lt;&lt;autoRefresh [observeTiddler: tiddler ...]&gt;&gt;
}}}
|{{{observeTiddler}}}|(optional) when specified the refresh will only happen when one of the tiddlers specified is changed.|
!Source Code
***/
//{{{

if (!window.abego) window.abego = {};

// autoRefresh Macro =============================================================
//
(function() {


var REFRESHER_NAME = &quot;abego_onEveryChange&quot;;

var tiddlersToRefresh = {}; // A set holding the names of tiddlers to be refreshed

var onEveryChangeRefresher = function(e,changeList) {
	
	var tiddlerElem = story.findContainingTiddler(e);
	if (!tiddlerElem) return false;

	var title = tiddlerElem.getAttribute(&quot;tiddler&quot;);
	if (!title) return false;

	// if &quot;observeTiddler&quot; are specified we only refresh if one of the given 
	// tiddlers has changed.
	var observedTiddlers = e.getAttribute(&quot;observedTiddlers&quot;);
	if (observedTiddlers) {
		var a = observedTiddlers.readBracketedList();
		if (!changeList || !a.containsAny(changeList))
			return;
	}

	// Refresh the tiddler asynchronously. 
	// This way we can avoid repeated refreshes (e.g. when a tiddler is renamed)
	tiddlersToRefresh[title] = true;
	setTimeout(function() {
		// Refresh all tiddlers in tiddlersToRefresh
		for(var title in tiddlersToRefresh)
			story.refreshTiddler(title,null,true);

		// We have refreshed all pending tiddlers. Clear the set.
		tiddlersToRefresh = {};
	}, 0);

	return true;
}

config.refreshers[REFRESHER_NAME] = onEveryChangeRefresher;


config.macros.autoRefresh = {};

config.macros.autoRefresh.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
    params = paramString.parseParams(&quot;observeTiddler&quot;,null,true,false,true); // allowEval, cascadeDefaults, names allowed

	var e = createTiddlyElement(place,&quot;span&quot;);
	e.setAttribute(&quot;refresh&quot;,REFRESHER_NAME);
	var observedTiddlers = params[0][&quot;observeTiddler&quot;];
	if (observedTiddlers &amp;&amp; observedTiddlers.length) {
		var s = &quot;[[&quot;+observedTiddlers.join(&quot;]] [[&quot;)+&quot;]]&quot;;
		e.setAttribute(&quot;observedTiddlers&quot;,s);
	}
};


})();

//}}}</pre>
</div>
<div title="BackupOptionsPlugin" modifier="dger" created="201010030910" modified="201010031123" tags="systemConfig plugin pluginInfo %tw-elnb">
<pre>/***
|''Name:''|BackupOptionsPlugin|
|''Version:''|1.0.1 (2007-09-29)|
|''Source:''|None|
|''Author:''|Tyler Akins|
|''Licence:''|Public domain|
|''TiddlyWiki:''|2.0+|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|

!Description
Tired of having thousands of backups made due to saving every minor edit?  Do you only want one backup per hour, day, or just one backup ever?  Not a problem.

This plugin lets you define a file format that you want to use when saving backups.  Because backups will overwrite each other if they have the same name, you can now control how often new backup files are created.  If you want one created every day, just include the year, month, and day in your format and avoid using the hours, minutes, seconds, and milliseconds.  If you want only one backup, set a static name and it will just keep overwriting the old file.

!Configuration
Select what attributes you want to include in the backup filename in the order you like.  Dates are all in UTC format.  If the format field is left blank, it defaults to what the backups would normally be named:  {{{%N.%Y%M%D.%h%m%s%n.html}}}

{{wideInput{&lt;&lt;option txtBackupOptionsFormat 40&gt;&gt;}}}

|!Code|!Description|!Example|
| ''%D'' |Day of month, two digits| 18 |
| ''%h'' |Hour, two digits, 24 hour format| 21 |
| ''%M'' |Month number, two digits| 11 |
| ''%m'' |Minute, two digits| 59 |
| ''%N'' |Base name of the wiki| TiddlyWiki |
| ''%n'' |Millisecond, four digits| 8441 |
| ''%s'' |Seconds, two digits| 06 |
| ''%Y'' |Year, four digits| 2006 |
| ''%y'' |Year, two digits| 06 |
| ''%%'' |A percent symbol| % |

!Examples
Based on a base filename of &quot;TiddlyWiki.html&quot;, and a date of 2006-11-18 21:59:06.8441, here are a few format options:

|!''Format''|!Description|
|!//Sample//|~|
| ''%N.bak'' |Saves only one backup, ever.  Always overwrites the .bak file with a new backup, keeping just one file around.|
| //TiddlyWiki.bak// |~|
| ''%N.%Y%M%D.%h%m%s%n.html'' |This is the default format that TiddlyWiki uses when making a new backup.|
| //TiddlyWiki.20061118.2159068441.html// |~|
| ''%N-%Y-%M-%D.html'' |Keep around only one backup per day.  When a new backup is made, it will overwrite any other backups made on that day.|
| //TiddlyWiki-2006-11-18.html// |~|
| ''Backups\%Y%M\%N-%D-%h%m.bak'' |Save all backups in a set of directories, with one directory that contains all, then another subdirectory that holds a year and month, and then the backup file.|
| //Backups\200611\TiddlyWiki-18-2159.bak// |~|

!Revision history
* v1.0.0 (2007-09-29)
** Initial release

!Code
***/
//{{{
//============================================================================
//                           BackupOptionsPlugin

// Ensure that the BackupOptionsPlugin is only installed once.
//

if (!version.extensions.BackupOptionsPlugin) {

setStylesheet(&quot;.wideInput input { width:30em; }&quot;,&quot;BackupOptionsStylesheet&quot;);

version.extensions.BackupOptionsPlugin = {
    major: 1, minor: 0, revision: 0,
    date: new Date(2007, 9, 11), 
    type: 'plugin',
    source: &quot;http://rumkin.com/tools/tiddlywiki/#BackupOptionsPlugin&quot;
};


if (!config.options.txtBackupOptionsFormat)
	config.options.txtBackupOptionsFormat = &quot;%N.%Y%M%D.%h%m%s%n.html&quot;; // Same as default format
if (config.optionsDesc)
	config.optionsDesc.txtBackupOptionsFormat = &quot;Filename format for backups.&quot;

if (version.major &lt; 2) alertAndThrow(&quot;BackupOptionsPlugin requires TiddlyWiki 2.0 or newer.&quot;);

//============================================================================
// Overwrite the built-in functions

getBackupPath = function(localPath) {
	var formatString = config.options['txtBackupOptionsFormat'];
	if (formatString == undefined || ! formatString || formatString == '')
		formatString = '%N.%Y%M%D.%h%m%s%n.html';
	var backSlash = true;
	var dirPathPos = localPath.lastIndexOf(&quot;\\&quot;);
	if (dirPathPos == -1)
	{
		dirPathPos = localPath.lastIndexOf(&quot;/&quot;);
		backSlash = false;
	}
	var backupFolder = config.options.txtBackupFolder;
	if (! backupFolder || backupFolder == '')
		backupFolder = '.';
	backupFolder += (backSlash ? &quot;\\&quot; : '/');
	var backupPath = localPath.substr(0, dirPathPos) + (backSlash ? &quot;\\&quot; : '/') + backupFolder;
	var backupBase = localPath.substr(dirPathPos)
	backupBase = backupBase.substr(0, backupBase.lastIndexOf('.'));
	var d = new Date()
	while (formatString.length &gt; 0)
	{
		var formatHandled = 0;
		if (formatString.length &gt; 1 &amp;&amp; formatString.charAt(0) == '%')
		{
			formatHandled = 1;
			switch (formatString.charAt(1))
			{
				case 'D':
					backupPath += String.zeroPad(d.getUTCDate(), 2);
					break;
				case 'h':
					backupPath += String.zeroPad(d.getUTCHours(), 2);
					break;
				case 'M':
					backupPath += String.zeroPad(d.getUTCMonth(), 2);
					break;
				case 'm':
					backupPath += String.zeroPad(d.getUTCMinutes(), 2);
					break;
				case 'N':
					backupPath += backupBase;
					break;
				case 'n':
					backupPath += String.zeroPad(d.getUTCMilliseconds(), 4);
					break;
				case 's':
					backupPath += String.zeroPad(d.getUTCSeconds(), 4);
					break;
				case 'Y':
					backupPath += String.zeroPad(d.getUTCFullYear(), 4);
					break;
				case 'y':
					backupPath += String.zeroPad(d.getUTCFullYear() % 100, 4);
					break;
				case '%':
					backupPath += '%';
					break;
				default:
					formatHandled = 0;
			}
			if (formatHandled)
				formatString = formatString.substr(2);
		}
		if (! formatHandled)
		{
			backupPath += formatString.charAt(0);
			formatString = formatString.substr(1);
		}
	}

	return backupPath;
}

} // of &quot;install only once&quot;
//}}}
/***

!Licence and Copyright
You are free to use this however you like.  I place this code into the public domain.
***/
</pre>
</div>
<div title="CalendarPlugin" modifier="dger" created="201007171119" modified="201009301849" tags="systemConfig plugin pluginInfo %tw-elnb">
<pre>/***
|Name|CalendarPlugin|
|Source|http://www.TiddlyTools.com/#CalendarPlugin|
|Version|1.5.0|
|Author|Eric Shulman|
|Original Author|SteveRumsby|
|License|unknown|
|~CoreVersion|2.1|
|Type|plugin|
|Description|display monthly and yearly calendars|
NOTE: For //enhanced// date popup display, optionally install [[DatePlugin]] and [[ReminderMacros]]
!!!Usage:
&lt;&lt;&lt;
|{{{&lt;&lt;calendar&gt;&gt;}}}|full-year calendar for the current year|
|{{{&lt;&lt;calendar year&gt;&gt;}}}|full-year calendar for the specified year|
|{{{&lt;&lt;calendar year month&gt;&gt;}}}|one month calendar for the specified month and year|
|{{{&lt;&lt;calendar thismonth&gt;&gt;}}}|one month calendar for the current month|
|{{{&lt;&lt;calendar lastmonth&gt;&gt;}}}|one month calendar for last month|
|{{{&lt;&lt;calendar nextmonth&gt;&gt;}}}|one month calendar for next month|
|{{{&lt;&lt;calendar +n&gt;&gt;}}}&lt;br&gt;{{{&lt;&lt;calendar -n&gt;&gt;}}}|one month calendar for a month +/- 'n' months from now|
&lt;&lt;&lt;
!!!Configuration:
&lt;&lt;&lt;
|''First day of week:''&lt;br&gt;{{{config.options.txtCalFirstDay}}}|&lt;&lt;option txtCalFirstDay&gt;&gt;|(Monday = 0, Sunday = 6)|
|''First day of weekend:''&lt;br&gt;{{{config.options.txtCalStartOfWeekend}}}|&lt;&lt;option txtCalStartOfWeekend&gt;&gt;|(Monday = 0, Sunday = 6)|

&lt;&lt;option chkDisplayWeekNumbers&gt;&gt; Display week numbers //(note: Monday will be used as the start of the week)//
|''Week number display format:''&lt;br&gt;{{{config.options.txtWeekNumberDisplayFormat }}}|&lt;&lt;option txtWeekNumberDisplayFormat &gt;&gt;|
|''Week number link format:''&lt;br&gt;{{{config.options.txtWeekNumberLinkFormat }}}|&lt;&lt;option txtWeekNumberLinkFormat &gt;&gt;|
&lt;&lt;&lt;
!!!Revisions
&lt;&lt;&lt;
2009.04.31 [1.5.0] rewrote onClickCalendarDate() (popup handler) and added config.options.txtCalendarReminderTags.  Partial code reduction/cleanup.  Assigned true version number (1.5.0)
2008.09.10 added '+n' (and '-n') param to permit display of relative months (e.g., '+6' means 'six months from now', '-3' means 'three months ago'.  Based on suggestion from Jean.
2008.06.17 added support for config.macros.calendar.todaybg
2008.02.27 in handler(), DON'T set hard-coded default date format, so that *customized* value (pre-defined in config.macros.calendar.journalDateFmt is used.
2008.02.17 in createCalendarYear(), fix next/previous year calculation (use parseInt() to convert to numeric value).  Also, use journalDateFmt for date linking when NOT using [[DatePlugin]].
2008.02.16 in createCalendarDay(), week numbers now created as TiddlyLinks, allowing quick creation/navigation to 'weekly' journals (based on request from Kashgarinn)
2008.01.08 in createCalendarMonthHeader(), 'month year' heading is now created as TiddlyLink, allowing quick creation/navigation to 'month-at-a-time' journals
2007.11.30 added 'return false' to onclick handlers (prevent IE from opening blank pages)
2006.08.23 added handling for weeknumbers (code supplied by Martin Budden (see 'wn**' comment marks).  Also, incorporated updated by Jeremy Sheeley to add caching for reminders (see [[ReminderMacros]], if installed)
2005.10.30 in config.macros.calendar.handler(), use 'tbody' element for IE compatibility.  Also, fix year calculation for IE's getYear() function (which returns '2005' instead of '105'). Also, in createCalendarDays(), use showDate() function (see [[DatePlugin]], if installed) to render autostyled date with linked popup.  Updated calendar stylesheet definition: use .calendar class-specific selectors, add text centering and margin settings
2006.05.29 added journalDateFmt handling
&lt;&lt;&lt;
!!!Code
***/
//{{{
version.extensions.CalendarPlugin= { major: 1, minor: 5, revision: 0, date: new Date(2009,5,31)};
//}}}
//{{{
if(config.options.txtCalFirstDay == undefined)
	config.options.txtCalFirstDay = 0;
if(config.options.txtCalStartOfWeekend == undefined)
	config.options.txtCalStartOfWeekend = 5;
if(config.options.chkDisplayWeekNumbers == undefined)
	config.options.chkDisplayWeekNumbers = false;
if(config.options.chkDisplayWeekNumbers)
	config.options.txtCalFirstDay = 0;
if(config.options.txtWeekNumberDisplayFormat == undefined)
	config.options.txtWeekNumberDisplayFormat = 'w0WW';
if(config.options.txtWeekNumberLinkFormat == undefined)
	config.options.txtWeekNumberLinkFormat = 'YYYY-w0WW';
if(config.options.txtCalendarReminderTags == undefined)
	config.options.txtCalendarReminderTags = 'reminder';

config.macros.calendar = {
	monthnames:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
	daynames:['M','T','W','T','F','S','S'],
	todaybg:'#ccccff',
	weekendbg:'#c0c0c0',
	monthbg:'#e0e0e0',
	holidaybg:'#ffc0c0',
	journalDateFmt:'DD MMM YYYY',
	monthdays:[31,28,31,30,31,30,31,31,30,31,30,31],
	holidays:[ ] // for customization see [[CalendarPluginConfig]]
};
//}}}
//{{{
function calendarIsHoliday(date)
{
	var longHoliday = date.formatString('0DD/0MM/YYYY');
	var shortHoliday = date.formatString('0DD/0MM');
	for(var i = 0; i &lt; config.macros.calendar.holidays.length; i++) {
		if(   config.macros.calendar.holidays[i]==longHoliday
		   || config.macros.calendar.holidays[i]==shortHoliday)
			return true;
	}
	return false;
}
//}}}
//{{{
config.macros.calendar.handler = function(place,macroName,params) {
	var calendar = createTiddlyElement(place, 'table', null, 'calendar', null);
	var tbody = createTiddlyElement(calendar, 'tbody');
	var today = new Date();
	var year = today.getYear();
	if (year&lt;1900) year+=1900;

 	// get journal format from SideBarOptions (ELS 5/29/06 - suggested by MartinBudden)
	var text = store.getTiddlerText('SideBarOptions');
	var re = new RegExp('&lt;&lt;(?:newJournal)([^&gt;]*)&gt;&gt;','mg'); var fm = re.exec(text);
	if (fm &amp;&amp; fm[1]!=null) { var pa=fm[1].readMacroParams(); if (pa[0]) this.journalDateFmt = pa[0]; }

	var month=-1;
	if (params[0] == 'thismonth') {
		var month=today.getMonth();
	} else if (params[0] == 'lastmonth') {
		var month = today.getMonth()-1; if (month==-1) { month=11; year--; }
	} else if (params[0] == 'nextmonth') {
		var month = today.getMonth()+1; if (month&gt;11) { month=0; year++; }
	} else if (params[0]&amp;&amp;'+-'.indexOf(params[0].substr(0,1))!=-1) {
		var month = today.getMonth()+parseInt(params[0]);
		if (month&gt;11) { year+=Math.floor(month/12); month%=12; };
		if (month&lt;0)  { year+=Math.floor(month/12); month=12+month%12; }
	} else if (params[0]) {
		year = params[0];
		if(params[1]) month=parseInt(params[1])-1;
		if (month&gt;11) month=11; if (month&lt;0) month=0;
	}

	if (month!=-1) {
		cacheReminders(new Date(year, month, 1, 0, 0), 31);
		createCalendarOneMonth(tbody, year, month);
	} else {
		cacheReminders(new Date(year, 0, 1, 0, 0), 366);
		createCalendarYear(tbody, year);
	}
	window.reminderCacheForCalendar = null;
}
//}}}
//{{{
// cache used to store reminders while the calendar is being rendered
// it will be renulled after the calendar is fully rendered.
window.reminderCacheForCalendar = null;
//}}}
//{{{
function cacheReminders(date, leadtime)
{
	if (window.findTiddlersWithReminders == null) return;
	window.reminderCacheForCalendar = {};
	var leadtimeHash = [];
	leadtimeHash [0] = 0;
	leadtimeHash [1] = leadtime;
	var t = findTiddlersWithReminders(date, leadtimeHash, null, 1);
	for(var i = 0; i &lt; t.length; i++) {
		//just tag it in the cache, so that when we're drawing days, we can bold this one.
		window.reminderCacheForCalendar[t[i]['matchedDate']] = 'reminder:' + t[i]['params']['title']; 
	}
}
//}}}
//{{{
function createCalendarOneMonth(calendar, year, mon)
{
	var row = createTiddlyElement(calendar, 'tr');
	createCalendarMonthHeader(calendar, row, config.macros.calendar.monthnames[mon]+' '+year, true, year, mon);
	row = createTiddlyElement(calendar, 'tr');
	createCalendarDayHeader(row, 1);
	createCalendarDayRowsSingle(calendar, year, mon);
}
//}}}
//{{{
function createCalendarMonth(calendar, year, mon)
{
	var row = createTiddlyElement(calendar, 'tr');
	createCalendarMonthHeader(calendar, row, config.macros.calendar.monthnames[mon]+' '+ year, false, year, mon);
	row = createTiddlyElement(calendar, 'tr');
	createCalendarDayHeader(row, 1);
	createCalendarDayRowsSingle(calendar, year, mon);
}
//}}}
//{{{
function createCalendarYear(calendar, year)
{
	var row;
	row = createTiddlyElement(calendar, 'tr');
	var back = createTiddlyElement(row, 'td');
	var backHandler = function() {
		removeChildren(calendar);
		createCalendarYear(calendar, parseInt(year)-1);
		return false; // consume click
	};
	createTiddlyButton(back, '&lt;', 'Previous year', backHandler);
	back.align = 'center';
	var yearHeader = createTiddlyElement(row, 'td', null, 'calendarYear', year);
	yearHeader.align = 'center';
	yearHeader.setAttribute('colSpan',config.options.chkDisplayWeekNumbers?22:19);//wn**
	var fwd = createTiddlyElement(row, 'td');
	var fwdHandler = function() {
		removeChildren(calendar);
		createCalendarYear(calendar, parseInt(year)+1);
		return false; // consume click
	};
	createTiddlyButton(fwd, '&gt;', 'Next year', fwdHandler);
	fwd.align = 'center';
	createCalendarMonthRow(calendar, year, 0);
	createCalendarMonthRow(calendar, year, 3);
	createCalendarMonthRow(calendar, year, 6);
	createCalendarMonthRow(calendar, year, 9);
}
//}}}
//{{{
function createCalendarMonthRow(cal, year, mon)
{
	var row = createTiddlyElement(cal, 'tr');
	createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon], false, year, mon);
	createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon+1], false, year, mon);
	createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon+2], false, year, mon);
	row = createTiddlyElement(cal, 'tr');
	createCalendarDayHeader(row, 3);
	createCalendarDayRows(cal, year, mon);
}
//}}}
//{{{
function createCalendarMonthHeader(cal, row, name, nav, year, mon)
{
	var month;
	if (nav) {
		var back = createTiddlyElement(row, 'td');
		back.align = 'center';
		back.style.background = config.macros.calendar.monthbg;

		var backMonHandler = function() {
			var newyear = year;
			var newmon = mon-1;
			if(newmon == -1) { newmon = 11; newyear = newyear-1;}
			removeChildren(cal);
			cacheReminders(new Date(newyear, newmon , 1, 0, 0), 31);
			createCalendarOneMonth(cal, newyear, newmon);
			return false; // consume click
		};
		createTiddlyButton(back, '&lt;', 'Previous month', backMonHandler);
		month = createTiddlyElement(row, 'td', null, 'calendarMonthname')
		createTiddlyLink(month,name,true);
		month.setAttribute('colSpan', config.options.chkDisplayWeekNumbers?6:5);//wn**
		var fwd = createTiddlyElement(row, 'td');
		fwd.align = 'center';
		fwd.style.background = config.macros.calendar.monthbg; 

		var fwdMonHandler = function() {
			var newyear = year;
			var newmon = mon+1;
			if(newmon == 12) { newmon = 0; newyear = newyear+1;}
			removeChildren(cal);
			cacheReminders(new Date(newyear, newmon , 1, 0, 0), 31);
			createCalendarOneMonth(cal, newyear, newmon);
			return false; // consume click
		};
		createTiddlyButton(fwd, '&gt;', 'Next month', fwdMonHandler);
	} else {
		month = createTiddlyElement(row, 'td', null, 'calendarMonthname', name)
		month.setAttribute('colSpan',config.options.chkDisplayWeekNumbers?8:7);//wn**
	}
	month.align = 'center';
	month.style.background = config.macros.calendar.monthbg;
}
//}}}
//{{{
function createCalendarDayHeader(row, num)
{
	var cell;
	for(var i = 0; i &lt; num; i++) {
		if (config.options.chkDisplayWeekNumbers) createTiddlyElement(row, 'td');//wn**
		for(var j = 0; j &lt; 7; j++) {
			var d = j + (config.options.txtCalFirstDay - 0);
			if(d &gt; 6) d = d - 7;
			cell = createTiddlyElement(row, 'td', null, null, config.macros.calendar.daynames[d]);
			if(d == (config.options.txtCalStartOfWeekend-0) || d == (config.options.txtCalStartOfWeekend-0+1))
				cell.style.background = config.macros.calendar.weekendbg;
		}
	}
}
//}}}
//{{{
function createCalendarDays(row, col, first, max, year, mon) {
	var i;
	if (config.options.chkDisplayWeekNumbers){
		if (first&lt;=max) {
			var ww = new Date(year,mon,first);
			var td=createTiddlyElement(row, 'td');//wn**
			var link=createTiddlyLink(td,ww.formatString(config.options.txtWeekNumberLinkFormat),false);
			link.appendChild(document.createTextNode(
				ww.formatString(config.options.txtWeekNumberDisplayFormat)));
		}
		else createTiddlyElement(row, 'td');//wn**
	}
	for(i = 0; i &lt; col; i++)
		createTiddlyElement(row, 'td');
	var day = first;
	for(i = col; i &lt; 7; i++) {
		var d = i + (config.options.txtCalFirstDay - 0);
		if(d &gt; 6) d = d - 7;
		var daycell = createTiddlyElement(row, 'td');
		var isaWeekend=((d==(config.options.txtCalStartOfWeekend-0)
			|| d==(config.options.txtCalStartOfWeekend-0+1))?true:false);
		if(day &gt; 0 &amp;&amp; day &lt;= max) {
			var celldate = new Date(year, mon, day);
			// ELS 10/30/05 - use &lt;&lt;date&gt;&gt; macro's showDate() function to create popup
			// ELS 05/29/06 - use journalDateFmt 
			if (window.showDate) showDate(daycell,celldate,'popup','DD',
				config.macros.calendar.journalDateFmt,true, isaWeekend);
			else {
				if(isaWeekend) daycell.style.background = config.macros.calendar.weekendbg;
				var title = celldate.formatString(config.macros.calendar.journalDateFmt);
				if(calendarIsHoliday(celldate))
					daycell.style.background = config.macros.calendar.holidaybg;
				var now=new Date();
				if ((now-celldate&gt;=0) &amp;&amp; (now-celldate&lt;86400000)) // is today?
					daycell.style.background = config.macros.calendar.todaybg;
				if(window.findTiddlersWithReminders == null) {
					var link = createTiddlyLink(daycell, title, false);
					link.appendChild(document.createTextNode(day));
				} else
					var button = createTiddlyButton(daycell, day, title, onClickCalendarDate);
			}
		}
		day++;
	}
}
//}}}
//{{{
// Create a pop-up containing:
// * a link to a tiddler for this date
// * a 'new tiddler' link to add a reminder for this date
// * links to current reminders for this date
// NOTE: this code is only used if [[ReminderMacros]] is installed AND [[DatePlugin]] is //not// installed.
function onClickCalendarDate(ev) { ev=ev||window.event;
	var d=new Date(this.getAttribute('title')); var date=d.formatString(config.macros.calendar.journalDateFmt);
	var p=Popup.create(this);  if (!p) return;
	createTiddlyLink(createTiddlyElement(p,'li'),date,true);
	var rem='\\n\\&lt;\\&lt;reminder day:%0 month:%1 year:%2 title: \\&gt;\\&gt;';
	rem=rem.format([d.getDate(),d.getMonth()+1,d.getYear()+1900]);
	var cmd=&quot;&lt;&lt;newTiddler label:[[new reminder...]] prompt:[[add a new reminder to '%0']]&quot;
		+&quot; title:[[%0]] text:{{store.getTiddlerText('%0','')+'%1'}} tag:%2&gt;&gt;&quot;;
	wikify(cmd.format([date,rem,config.options.txtCalendarReminderTags]),p);
	createTiddlyElement(p,'hr');
	var t=findTiddlersWithReminders(d,[0,31],null,1);
	for(var i=0; i&lt;t.length; i++) {
		var link=createTiddlyLink(createTiddlyElement(p,'li'), t[i].tiddler, false);
		link.appendChild(document.createTextNode(t[i]['params']['title']));
	}
	Popup.show(); ev.cancelBubble=true; if (ev.stopPropagation) ev.stopPropagation(); return false;
}
//}}}
//{{{
function calendarMaxDays(year, mon)
{
	var max = config.macros.calendar.monthdays[mon];
	if(mon == 1 &amp;&amp; (year % 4) == 0 &amp;&amp; ((year % 100) != 0 || (year % 400) == 0)) max++;
	return max;
}
//}}}
//{{{
function createCalendarDayRows(cal, year, mon)
{
	var row = createTiddlyElement(cal, 'tr');
	var first1 = (new Date(year, mon, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
	if(first1 &lt; 0) first1 = first1 + 7;
	var day1 = -first1 + 1;
	var first2 = (new Date(year, mon+1, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
	if(first2 &lt; 0) first2 = first2 + 7;
	var day2 = -first2 + 1;
	var first3 = (new Date(year, mon+2, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
	if(first3 &lt; 0) first3 = first3 + 7;
	var day3 = -first3 + 1;

	var max1 = calendarMaxDays(year, mon);
	var max2 = calendarMaxDays(year, mon+1);
	var max3 = calendarMaxDays(year, mon+2);

	while(day1 &lt;= max1 || day2 &lt;= max2 || day3 &lt;= max3) {
		row = createTiddlyElement(cal, 'tr');
		createCalendarDays(row, 0, day1, max1, year, mon); day1 += 7;
		createCalendarDays(row, 0, day2, max2, year, mon+1); day2 += 7;
		createCalendarDays(row, 0, day3, max3, year, mon+2); day3 += 7;
	}
}
//}}}
//{{{
function createCalendarDayRowsSingle(cal, year, mon)
{
	var row = createTiddlyElement(cal, 'tr');
	var first1 = (new Date(year, mon, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
	if(first1 &lt; 0) first1 = first1+ 7;
	var day1 = -first1 + 1;
	var max1 = calendarMaxDays(year, mon);
	while(day1 &lt;= max1) {
		row = createTiddlyElement(cal, 'tr');
		createCalendarDays(row, 0, day1, max1, year, mon); day1 += 7;
	}
}
//}}}
//{{{
setStylesheet('.calendar, .calendar table, .calendar th, .calendar tr, .calendar td { text-align:center; } .calendar, .calendar a { margin:0px !important; padding:0px !important; }', 'calendarStyles');
//}}}</pre>
</div>
<div title="CalendarPluginConfig" modifier="escdie" created="201007171120" modified="201011101809" tags="systemConfig plugin pluginConfig %tw-elnb">
<pre>// override cookie settings for CalendarPlugin:
//{{{
config.options.txtCalFirstDay=7;
config.options.txtCalStartOfWeekend=5;
//}}}

// override internal default settings for CalendarPlugin:
//{{{
config.macros.calendar.journalDateFmt=&quot;DDD MMM 0DD YYYY&quot;;
//}}}</pre>
</div>
<div title="CookieJar" modifier="escdie" created="201010230729" modified="201011101810" tags="systemConfig %tw-elnb">
<pre>/***
&lt;&lt;tiddler CookieManager&gt;&gt;
***/
/***
!!![[Portable cookies:|CookieSaverPlugin]] {{fine{&lt;&lt;option chkPortableCookies&gt;&gt;enable &lt;&lt;option chkMonitorCookieJar&gt;&gt;monitor}}}
^^This section is ''//__automatically maintained__//'' by [[CookieSaverPlugin]].  To block specific cookies, see [[CookieSaverPluginConfig]].^^
***/
//{{{
if (config.options.txtUserName==&quot;escdie&quot; &amp;&amp; config.options.chkPortableCookies) {
	config.options[&quot;chkPortableCookies&quot;]=false;
	config.options[&quot;txtBackupOptionsFormat&quot;]=&quot;%N_-_%Y-%M_BAK.html&quot;;
	config.options[&quot;txtToDoPanel&quot;]=&quot;Now&quot;;
	config.options[&quot;txtMoreTab&quot;]=&quot;Shadowed&quot;;
	config.options[&quot;chkPreviewText&quot;]=true;
	config.options[&quot;chkShowRightSidebar&quot;]=true;
	config.options[&quot;chkShowLeftSidebar&quot;]=true;
	config.options[&quot;chkUseYourSearch&quot;]=true;
	config.options[&quot;chkInsertTabs&quot;]=true;
	config.options[&quot;txtFontSize&quot;]=&quot;100&quot;;
	config.options[&quot;chkSaveStory&quot;]=true;
	config.options[&quot;chkStoryAllowAdd&quot;]=true;
	config.options[&quot;chkStoryFold&quot;]=false;
	config.options[&quot;chkStoryClose&quot;]=true;
	config.options[&quot;chkStoryTop&quot;]=false;
	config.options[&quot;txtSavedStory&quot;]=&quot;[[UnsavedTiddlers]] [[Dashboard]]&quot;;
	config.options[&quot;chkAutoSave&quot;]=true;
	config.options[&quot;chkFileDropContent&quot;]=false;
	config.options[&quot;txtFileDropTags&quot;]=&quot;archive&quot;;
	config.options[&quot;txtMessageLogDateFormat&quot;]=&quot;YYYY-0MM-0DD 0hh:0mm:0ss&quot;;
	config.options[&quot;chkMessageLog&quot;]=false;
	config.options[&quot;chkAdvancedOptions&quot;]=true;
	config.options[&quot;chkAdvancedOptionsBackstage&quot;]=true;
	config.options[&quot;chkCookieJarAddToAdvancedOptions&quot;]=false;
	config.options[&quot;txtTemporaryTag&quot;]=&quot;%temp&quot;;
	config.options[&quot;txtAdvancedOptionsFallback&quot;]=&quot;Configuration&quot;;
	config.options[&quot;chkDatePopupHideReminders&quot;]=false;
	config.options[&quot;chkHTMLHideLinebreaks&quot;]=false;
	config.options[&quot;chkAnimate&quot;]=false;
	config.options[&quot;txtJournaPanel&quot;]=&quot;TimeLog&quot;;
	config.options[&quot;chkMonitorCookieJar&quot;]=true;
	config.options[&quot;txtMainPanel&quot;]=&quot;Main&quot;;
}

if (config.options.txtUserName==&quot;admin&quot; &amp;&amp; config.options.chkPortableCookies) {
	config.options[&quot;chkPortableCookies&quot;]=true;
	config.options[&quot;txtBackupOptionsFormat&quot;]=&quot;%N_-_%Y-%M_BAK.html&quot;;
	config.options[&quot;txtToDoPanel&quot;]=&quot;Next&quot;;
	config.options[&quot;txtMoreTab&quot;]=&quot;Shadowed&quot;;
	config.options[&quot;chkPreviewText&quot;]=true;
	config.options[&quot;chkShowRightSidebar&quot;]=true;
	config.options[&quot;chkShowLeftSidebar&quot;]=true;
	config.options[&quot;chkUseYourSearch&quot;]=true;
	config.options[&quot;chkInsertTabs&quot;]=true;
	config.options[&quot;txtFontSize&quot;]=&quot;100&quot;;
	config.options[&quot;chkSaveStory&quot;]=true;
	config.options[&quot;chkStoryAllowAdd&quot;]=true;
	config.options[&quot;chkStoryFold&quot;]=false;
	config.options[&quot;chkStoryClose&quot;]=true;
	config.options[&quot;chkStoryTop&quot;]=false;
	config.options[&quot;txtSavedStory&quot;]=&quot;[[UnsavedTiddlers]] [[Dashboard]]&quot;;
	config.options[&quot;chkAutoSave&quot;]=true;
	config.options[&quot;chkFileDropContent&quot;]=false;
	config.options[&quot;txtFileDropTags&quot;]=&quot;archive&quot;;
	config.options[&quot;txtMessageLogDateFormat&quot;]=&quot;YYYY-0MM-0DD 0hh:0mm:0ss&quot;;
	config.options[&quot;chkMessageLog&quot;]=false;
	config.options[&quot;chkAdvancedOptions&quot;]=true;
	config.options[&quot;chkAdvancedOptionsBackstage&quot;]=true;
	config.options[&quot;chkCookieJarAddToAdvancedOptions&quot;]=false;
	config.options[&quot;txtTemporaryTag&quot;]=&quot;temp&quot;;
	config.options[&quot;txtAdvancedOptionsFallback&quot;]=&quot;Configuration&quot;;
}
//}}}
// // /% end portable cookies %/
</pre>
</div>
<div title="CookieSaverPlugin" modifier="dger" created="201009180629" modified="201009301853" tags="plugin CookieSaverPackage systemConfig %tw-elnb">
<pre>/***
|Name|CookieSaverPlugin|
|Source|http://www.TiddlyTools.com/#CookieSaverPlugin|
|Version|1.1.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|automatically save TiddlyWiki cookie options to [[CookieJar]] tiddler for portable settings|
!!!!!Usage
&lt;&lt;&lt;
Whenever TiddlyWiki option settings are changed, a browser-based cookie value is added, removed, or changed.  Each time this occurs, the CookieSaverPlugin generates an equivalent ''portable cookie'': a single line of javascript code that assigns a stored value directly to the specific TiddlyWiki internal config.options.* variable corresponding to the browser cookie with the same name.

The portable cookies are automatically written into a tiddler named [[CookieJar]] that is tagged with&lt;&lt;tag systemConfig&gt;&gt;so that their values will be applied as soon as the document is saved and reloaded.  You can change or delete an individual portable cookie by editing the contents of the [[CookieJar]] and removing the appropriate line of javascript from the tiddler source code.  Note: editing the portable cookie definitions does not alter the values of any corresponding browser cookies, nor does it update the internal value that is in use within the current TiddlyWiki document session.  Changes made directly to the [[CookieJar]] are only applied after saving and reloading the document.  In any case, whenever a browser cookie value is updated, any modifications you made to the equivalent portable cookie are immediately rewritten to reflect the current browser cookie value.

Browser cookies are, obviously, stored with your browser... and are kept separate from the document itself.  In contrast, because your portable cookies are stored in a [[CookieJar]] within the document, they remain part of that document.

When the document is copied and shared with others, each copy includes the [[CookieJar]] containing //your// stored portable cookies.  Fortunately, CookieSaverPlugin can generate and maintain several separate sets of portable cookies in the same [[CookieJar]] tiddler, where each set is associated with a different TiddlyWiki username.  As long as other readers have not chosen the same username, your portable cookie values will not be automatically applied when they are reading the document.  Rather, as they interact with the document, a new set of portable cookies, associated with //their// username, will be automatically added to the [[CookieJar]].

In addition to tracking and applying separate portable cookies for each user, CookieSaverPlugin can also be configured so that sensitive data (such as internal URLs, email addresses, login IDs and passwords, etc.) will never be inadvertently stored in the [[CookieJar]].  To achieve this, you can selectively prevent specific cookienames from being used as portable cookies by placing a special javascript function definition in a tiddler named [[CookieSaverPluginConfig]], tagged with 'systemConfig':
{{{
config.macros.cookieSaver.allowPortableCookie=function(name){
	if ( ... some test using 'name' ...) return false;
	if ( ... another test with 'name' ...) return true;
	etc.
	return true;  // default=allow
}
}}}
The allowPortableCookie() function offers a flexible method for plugin developers and other technically skilled document authors to implement their own custom-defined, application-specific cookie data protection by applying sophisticated logic for deciding which cookies should be allowed or blocked based on variety of different conditions.  The basic operation of this function is to accept a cookie name as text input, apply some tests based on that cookie name (combined with any other useful criteria), and then return //true// if saving the portable cookie should be permitted, or //false// if the cookie should be excluded from the [[CookieJar]].

Unfortunately, although the technical expertise needed to write this test function is relatively minor, the level of programming ability that is needed can nonetheless be beyond the skills that many people possess.  To help address this, CookieSaverPlugin also supports an alternative syntax that allows you to define a simple array of cookie names that is used by the plugin to automatically block the indicated names from being included as portable cookies in the [[CookieJar]].  The array definition syntax looks like this:
{{{
// define a complete set of blocked cookie names
config.macros.cookieSaver.blockedCookies=['cookie','cookie','cookie',etc...];
}}}
or
{{{
// add individual cookies names to the current set of blocked cookies
config.macros.cookieSaver.blockedCookies.push('cookie');
config.macros.cookieSaver.blockedCookies.push('cookie');
etc...
}}}
Note: the allowPortableCookie() function and the blockedCookies[] array are only used to limit the creation of portable cookies within the [[CookieJar]], and are //not// applied when creating normal browser cookies.  Thus, regardless of whether or not a given portable cookie has been excluded or permitted, all the usual TiddlyWiki settings and internal state data can still be saved as secure, private, local browser cookies that are never made visible to others, even when the document is shared.
&lt;&lt;&lt;
!!!!!Configuration
&lt;&lt;&lt;
&lt;&lt;option chkPortableCookies&gt;&gt; allow ~CookieSaver to store //''portable cookies''// in [[CookieJar]] tiddler
&lt;&lt;option chkMonitorCookieJar&gt;&gt; monitor ~CookieSaver activity (show messages whenever [[CookieJar]] is updated)
&lt;&lt;option chkCookieJarAddToAdvancedOptions&gt;&gt; display [[CookieJar]] in [[AdvancedOptions]]
^^//note: changing this setting does not take effect until you reload the document//^^
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.08.05 [1.1.0] changed CookieJar output format to support odd symbols in option names (e.g. '@')
2008.09.11 [1.0.2] automatically add portable cookies header to existing CookieJar (if any).  Also, added chkMonitorCookieJar option to display CookieJar activity messages
2008.09.10 [1.0.1] documentation, code cleanup, improvements in 'allowPortableCookie()' function handling
2008.09.09 [1.0.0] initial release
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.CookieSaverPlugin= {major: 1, minor: 1, revision: 0, date: new Date(2009,8,5)};

config.macros.cookieSaver = {
	target:
		config.options.txtCookieJar||&quot;CookieJar&quot;,
	init: function() {
		if (config.options.chkPortableCookies===undefined)
			config.options.chkPortableCookies=false;
		if (config.options.txtCookieJar===undefined)
			config.options.txtCookieJar=this.target;
		if (config.options.chkCookieJarAddToAdvancedOptions===undefined)
			config.options.chkCookieJarAddToAdvancedOptions=true;
		if (config.options.chkCookieJarAddToAdvancedOptions)
			config.shadowTiddlers.AdvancedOptions+=&quot;\n!!%0\n&gt;&lt;&lt;tiddler [[%0]]&gt;&gt;&quot;.format([this.target]);
		if (config.options.chkMonitorCookieJar===undefined)
			config.options.chkMonitorCookieJar=false;

		// add empty Portable Cookies section to shadow CookieJar
		var h=&quot;/***\n&lt;&lt;tiddler CookieManager&gt;&gt;\n***/\n&quot;;
		var t=(config.shadowTiddlers[this.target]||&quot;&quot;).replace(new RegExp(h.replace(/\*/g,'\\*'),''),'')
		config.shadowTiddlers[this.target]=this.header+this.footer+t;

		// add empty Portable Cookies section to real CookieJar (if one exists)
		if (store.tiddlerExists(this.target) &amp;&amp; !readOnly) {
			var tid=this.get(this.target);
			var t=tid.text;
			if (t.indexOf(this.header)==-1){
				t=this.header+this.footer+t.replace(new RegExp(h.replace(/\*/g,'\\*'),''),'');
				var who=config.options.chkForceMinorUpdate?tid.modifier:config.options.txtUserName;
				var when=config.options.chkForceMinorUpdate?tid.modified:new Date();
				store.saveTiddler(tid.title,tid.title,t,who,when,tid.tags,tid.fields);
				displayMessage(&quot;CookieSaver: added 'Portable Cookies' section to CookieJar&quot;);
			}
		}

		// add &quot;cookies&quot; backstage task
		if (config.tasks &amp;&amp; !config.tasks.cookies) { // for TW2.2b3 or above
			config.tasks.cookies = {
				text: &quot;cookies&quot;,
				tooltip: &quot;manage cookie-based option settings&quot;,
				content: &quot;{{groupbox{&lt;&lt;tiddler CookieManager&gt;&gt;&lt;&lt;tiddler [[%0]]&gt;&gt;}}}&quot;.format([this.target])
			}
			config.backstageTasks.push(&quot;cookies&quot;);
		}
	},
	header:
		 &quot;/***\n&lt;&lt;tiddler CookieManager&gt;&gt;\n***/\n&quot;
		+&quot;/***\n&quot;
		+&quot;!!![[Portable cookies:|CookieSaverPlugin]] &quot;
		+&quot;{{fine{&lt;&lt;option chkPortableCookies&gt;&gt;enable &lt;&lt;option chkMonitorCookieJar&gt;&gt;monitor}}}\n&quot;
		+&quot;^^This section is ''//__automatically maintained__//'' by [[CookieSaverPlugin]].  &quot;
		+&quot;To block specific cookies, see [[CookieSaverPluginConfig]].^^\n&quot;
		+&quot;***/\n&quot;,
	startUser:
		 &quot;//{{{\n&quot;
		+&quot;if (config.options.txtUserName==\&quot;%0\&quot; &amp;&amp; config.options.chkPortableCookies) {&quot;,
	endUser:
		&quot;\n}\n//}}}\n&quot;,
	footer:
		&quot;// // /% end portable cookies %/\n&quot;,
	get: function(tid) { // create or retrieve tiddler
		if (story.isDirty(tid)) return null; // tiddler is being hand-edited... leave it alone.
		var text=config.shadowTiddlers[this.target];
		var who=config.options.txtUserName;
		var when=new Date();
		var tags=['systemConfig'];
		return store.getTiddler(tid)||store.saveTiddler(tid,tid,text,who,when,tags,{});
	},
	format: function(name) {
		if (name.substr(0,3)=='chk')
			return '\tconfig.options[&quot;'+name+'&quot;]='+(config.options[name]?'true;':'false;');
		return '\tconfig.options[&quot;'+name+'&quot;]=&quot;'+config.options[name]+'&quot;;';
	},
	blockedCookies: [],
	allowPortableCookie: function(name) {
		return true;
	},
	set: function(name) {
		if (!name||!name.trim().length) return;
		if (name=='txtUserName' || this.blockedCookies.contains(name) || !this.allowPortableCookie(name)) {
			if (config.options.chkMonitorCookieJar &amp;&amp; !startingUp)
				displayMessage(&quot;CookieJar: blocked '&quot;+name+&quot;'&quot;);
			return false; // don't save excluded cookies
		}
		var tid=this.get(this.target);
		if (!tid) return false; // if no tiddler... do nothing
		var t=tid.text;
		if (t.indexOf(this.header)==-1) {  // re-add Portable Cookies section if it was deleted by hand edit
			var h=&quot;/***\n&lt;&lt;tiddler CookieManager&gt;&gt;\n***/\n&quot;;
			t=this.header+this.footer+t.replace(new RegExp(h.replace(/\*/g,'\\*'),''),'');
		}
		var who=config.options.txtUserName;
		var when=new Date();
		var startmark=this.startUser.format([who]);
		var endmark=this.endUser;
		var startpos=t.indexOf(startmark);
		if (startpos==-1) { // insert new user (just before footer)
			if (config.options.chkMonitorCookieJar &amp;&amp; !startingUp)
				displayMessage(&quot;CookieJar: added new user '&quot;+who+&quot;'&quot;);
			var addpos=t.indexOf(this.footer); if (addpos==-1) addpos=t.length;
			t=t.substr(0,addpos)+startmark+endmark+t.substr(addpos);
			startpos=addpos;
		}
		startpos+=startmark.length;
		var endpos=t.indexOf(endmark,startpos);
		var pre=t.substr(0,startpos);
		var lines=t.substring(startpos,endpos).split('\n');
		var post=t.substr(endpos);
		var code=this.format(name);
		var match='\tconfig.options[&quot;'+name+'&quot;]=';
		var found=false; var changed=false;
		for (var i=0; i&lt;lines.length; i++) { // find and replace existing setting
			if (lines[i].substr(0,match.length)==match) {
				found=true;
				if (changed=lines[i]!=code) lines[i]=code; // replace value
				if (config.options.chkMonitorCookieJar &amp;&amp; !startingUp &amp;&amp; changed)
					displayMessage(&quot;CookieJar: &quot;+code);
			}
		}
		if (!found &amp;&amp; code.length) { // OR, add new setting
			lines[lines.length]=code;
			if (config.options.chkMonitorCookieJar &amp;&amp; !startingUp)
				displayMessage(&quot;CookieJar: &quot;+code);
		}
		if (found &amp;&amp; !changed) return; // don't alter tiddler unless necessary
		t=pre+lines.join('\n')+post;
		var who=config.options.chkForceMinorUpdate?tid.modifier:config.options.txtUserName;
		var when=config.options.chkForceMinorUpdate?tid.modified:new Date();
		store.saveTiddler(this.target,this.target,t,who,when,tid.tags,tid.fields);
		story.refreshTiddler(this.target,null,true);
	},
	remove: function(name) {
		if (!name||!name.trim().length) return;
		var who=config.options.txtUserName;
		var when=new Date();
		var tid=store.getTiddler(this.target);
		if (!tid) return false; // if no tiddler... do nothing
		var t=tid.text;
		var who=config.options.txtUserName
		var startmark=this.startUser.format([who]);
		var endmark=this.endUser;
		var startpos=t.indexOf(startmark);
		if (startpos==-1) return false; // no such user... do nothing
		startpos+=startmark.length;
		var endpos=t.indexOf(endmark,startpos);
		var pre=t.substr(0,startpos);
		var lines=t.substring(startpos,endpos).split('\n');
		var post=t.substr(endpos);
		var match='\tconfig.options[&quot;'+name+'&quot;]';
		var found=false; var changed=false;
		for (var i=0; i&lt;lines.length; i++) { // find and remove setting
			if (lines[i].substr(0,match.length)==match) {
				lines.splice(i,1);
				changed=true;
				if (config.options.chkMonitorCookieJar &amp;&amp; !startingUp)
					displayMessage(&quot;CookieJar: deleted '&quot;+name+&quot;'&quot;);
				break;
			}
		}
		if (!changed) return; // not found... do nothing
		t=pre+lines.join('\n')+post;
		if (lines.length==1) { // no cookies left, remove user
			t=pre.substr(0,pre.length-startmark.length)+post.substr(endmark.length);
			if (config.options.chkMonitorCookieJar &amp;&amp; !startingUp)
				displayMessage(&quot;CookieJar: removed user '&quot;+who+&quot;'&quot;);
		}
		var who=config.options.chkForceMinorUpdate?tid.modifier:config.options.txtUserName;
		var when=config.options.chkForceMinorUpdate?tid.modified:new Date();
		store.saveTiddler(this.target,this.target,t,who,when,tid.tags,tid.fields);
		story.refreshTiddler(this.target,null,true);
	}
}
//}}}
//{{{
// Hijack saveOptionCookie() to add CookieSaver processing
config.macros.cookieSaver.saveOptionCookie=saveOptionCookie;
window.saveOptionCookie=function(name)
{
	config.macros.cookieSaver.saveOptionCookie.apply(this,arguments);
	if (!readOnly &amp;&amp; (config.options.chkPortableCookies || name==&quot;chkPortableCookies&quot;))
		config.macros.cookieSaver.set(name);
}
// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}
// ... and then hijack it to also remove any corresponding PortableCookie
config.macros.cookieSaver.removeCookie=removeCookie;
window.removeCookie=function(name)
{
	if (config.options.chkPortableCookies &amp;&amp; !readOnly)
		config.macros.cookieSaver.remove(name);
	config.macros.cookieSaver.removeCookie.apply(this,arguments);
}
//}}}</pre>
</div>
<div title="CookieSaverPluginConfig" modifier="escdie" created="201009180626" modified="201011101810" tags="pluginConfig systemConfig CookieSaverPackage %tw-elnb">
<pre>/***
|Name|CookieSaverPluginConfig|
|Source|http://www.TiddlyTools.com/#CookieSaverPluginConfig|
|Requires|CookieSaverPlugin|
|Description|custom settings for [[CookieSaverPlugin]]|
!!!!!Portable Cookie Configuration:
***/
// // &lt;&lt;option chkPortableCookies&gt;&gt; allow ~CookieSaver to store //''portable cookies''// in [[CookieJar]] tiddler
// // &lt;&lt;option chkMonitorCookieJar&gt;&gt; monitor ~CookieSaver activity (show messages whenever [[CookieJar]] is updated)
//{{{
// default to these settings:
// config.options.chkPortableCookies=false;	// when FALSE this blocks ALL portable cookies
// config.options.chkMonitorCookieJar=false;
//}}}

// // Individual cookie names can be added to the {{{config.macros.cookieSaver.blockedCookies}}} array to prevent them from being stored in the [[CookieJar]].
//{{{
var bc=config.macros.cookieSaver.blockedCookies;
bc.push(&quot;chkBackstage&quot;);		// core
bc.push(&quot;txtMainTab&quot;);			// TiddlyWiki: SideBarTabs
bc.push(&quot;txtTOCSortBy&quot;);		// TiddlyTools: TableOfContentsPlugin
bc.push(&quot;txtCatalogTab&quot;);		// TiddlyTools: CatalogTabs
bc.push(&quot;txtUploadFilename&quot;);		// BidiX: UploadPlugin
bc.push(&quot;txtUploadDir&quot;);		// BidiX: UploadPlugin
bc.push(&quot;pasPassword&quot;);			// BidiX: UploadPlugin
bc.push(&quot;pasUploadPassword&quot;);		// BidiX: UploadPlugin
//}}}
// // You can also define a javascript test function that determines whether or not any particular cookie name should be stored in the [[CookieJar]].  The following function should return FALSE if the portable cookie should be blocked, or TRUE if the cookie should be allowed:
//{{{
config.macros.cookieSaver.allowPortableCookie=function(name) {
	// add tests based on specific cookie names and runtime conditions
	if (name.substr(0,9)==&quot;chkSlider&quot;) 	return false;	// NestedSlidersPlugin
	if (name.substr(0,13)==&quot;txtFirstVisit&quot;)	return false;	// VisitCounter
	if (name.substr(0,12)==&quot;txtLastVisit&quot;)	return false;	// VisitCounter
	if (name.substr(0,13)==&quot;txtVisitCount&quot;)	return false;	// VisitCounter
	return true;
}
//}}}</pre>
</div>
<div title="DatePlugin" modifier="dger" created="201007171403" modified="201009240938" tags="systemConfig plugin %tw-elnb DateExtension">
<pre>/***
|Name|[[DatePlugin]]|
|Source|http://www.TiddlyTools.com/#DatePlugin|
|Documentation|http://www.TiddlyTools.com/#DatePluginInfo|
|Version|2.7.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|formatted dates plus popup menu with 'journal' link, changes and (optional) reminders|
This plugin provides a general approach to displaying formatted dates and/or links and popups that permit easy navigation and management of tiddlers based on their creation/modification dates.
!!!!!Documentation
&gt;see [[DatePluginInfo]]
!!!!!Configuration
&lt;&lt;&lt;
&lt;&lt;option chkDatePopupHideCreated&gt;&gt; omit 'created' section from date popups
&lt;&lt;option chkDatePopupHideChanged&gt;&gt; omit 'changed' section from date popups
&lt;&lt;option chkDatePopupHideTagged&gt;&gt; omit 'tagged' section from date popups
&lt;&lt;option chkDatePopupHideReminders&gt;&gt; omit 'reminders' section from date popups
&lt;&lt;option chkShowJulianDate&gt;&gt; display Julian day number (1-365) below current date

see [[DatePluginConfig]] for additional configuration settings, for use in calendar displays, including:
*date formats
*color-coded backgrounds
*annual fixed-date holidays
*weekends
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.05.31 [2.7.1] in addRemindersToPopup(), 'new reminder....' command now uses {{{&lt;&lt;newTiddler&gt;&gt;}}} macro.  Also, general code reduction/cleanup.
|please see [[DatePluginInfo]] for additional revision details|
2005.10.30 [0.9.0] pre-release
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.DatePlugin= {major: 2, minor: 7, revision: 1, date: new Date(2009,5,31)};

config.macros.date = {
	format: 'YYYY.0MM.0DD', // default date display format
	linkformat: 'YYYY.0MM.0DD', // 'dated tiddler' link format
	linkedbg: '#babb1e', // 'babble'
	todaybg: '#ffab1e', // 'fable'
	weekendbg: '#c0c0c0', // 'cocoa'
	holidaybg: '#ffaace', // 'face'
	createdbg: '#bbeeff', // 'beef'
	modifiedsbg: '#bbeeff', // 'beef'
	remindersbg: '#c0ffee', // 'coffee'
	weekend: [ 1,0,0,0,0,0,1 ], // [ day index values: sun=0, mon=1, tue=2, wed=3, thu=4, fri=5, sat=6 ],
	holidays: [ '01/01', '07/04', '07/24', '11/24' ]
		// NewYearsDay, IndependenceDay(US), Eric's Birthday (hooray!), Thanksgiving(US)
};

config.macros.date.handler = function(place,macroName,params)
{
	// default: display current date
	var now =new Date();
	var date=now;
	var mode='display';
	if (params[0]&amp;&amp;['display','popup','link'].contains(params[0].toLowerCase()))
		{ mode=params[0]; params.shift(); }

	if (!params[0] || params[0]=='today')
		{ params.shift(); }
	else if (params[0]=='filedate')
		{ date=new Date(document.lastModified); params.shift(); }
	else if (params[0]=='tiddler')
		{ date=store.getTiddler(story.findContainingTiddler(place).id.substr(7)).modified; params.shift(); }
	else if (params[0].substr(0,8)=='tiddler:')
		{ var t; if ((t=store.getTiddler(params[0].substr(8)))) date=t.modified; params.shift(); }
	else {
		var y = eval(params.shift().replace(/Y/ig,(now.getYear()&lt;1900)?now.getYear()+1900:now.getYear()));
		var m = eval(params.shift().replace(/M/ig,now.getMonth()+1));
		var d = eval(params.shift().replace(/D/ig,now.getDate()+0));
		date = new Date(y,m-1,d);
	}
	// date format with optional custom override
	var format=this.format; if (params[0]) format=params.shift();
	var linkformat=this.linkformat; if (params[0]) linkformat=params.shift();
	showDate(place,date,mode,format,linkformat);
}

window.showDate=showDate;
function showDate(place,date,mode,format,linkformat,autostyle,weekend)
{
	mode	  =mode||'display';
	format	  =format||config.macros.date.format;
	linkformat=linkformat||config.macros.date.linkformat;

	// format the date output
	var title=date.formatString(format);
	var linkto=date.formatString(linkformat);

	// just show the formatted output
	if (mode=='display') { place.appendChild(document.createTextNode(title)); return; }

	// link to a 'dated tiddler'
	var link = createTiddlyLink(place, linkto, false);
	link.appendChild(document.createTextNode(title));
	link.title = linkto;
	link.date = date;
	link.format = format;
	link.linkformat = linkformat;

	// if using a popup menu, replace click handler for dated tiddler link
	// with handler for popup and make link text non-italic (i.e., an 'existing link' look)
	if (mode=='popup') {
		link.onclick = onClickDatePopup;
		link.style.fontStyle='normal';
	}
	// format the popup link to show what kind of info it contains (for use with calendar generators)
	if (autostyle) setDateStyle(place,link,weekend);
}
//}}}
//{{{
// NOTE: This function provides default logic for setting the date style when displayed in a calendar
// To customize the date style logic, please see[[DatePluginConfig]]
function setDateStyle(place,link,weekend) {
	// alias variable names for code readability
	var date=link.date;
	var fmt=link.linkformat;
	var linkto=date.formatString(fmt);
	var cmd=config.macros.date;

	if ((weekend!==undefined?weekend:isWeekend(date))&amp;&amp;(cmd.weekendbg!=''))
		{ place.style.background = cmd.weekendbg; }
	if (hasModifieds(date)||hasCreateds(date)||hasTagged(date,fmt))
		{ link.style.fontStyle='normal'; link.style.fontWeight='bold'; }
	if (hasReminders(date))
		{ link.style.textDecoration='underline'; }
	if (isToday(date))
		{ link.style.border='1px solid black'; }
	if (isHoliday(date)&amp;&amp;(cmd.holidaybg!=''))
		{ place.style.background = cmd.holidaybg; }
	if (hasCreateds(date)&amp;&amp;(cmd.createdbg!=''))
		{ place.style.background = cmd.createdbg; }
	if (hasModifieds(date)&amp;&amp;(cmd.modifiedsbg!=''))
		{ place.style.background = cmd.modifiedsbg; }
	if ((hasTagged(date,fmt)||store.tiddlerExists(linkto))&amp;&amp;(cmd.linkedbg!=''))
		{ place.style.background = cmd.linkedbg; }
	if (hasReminders(date)&amp;&amp;(cmd.remindersbg!=''))
		{ place.style.background = cmd.remindersbg; }
	if (isToday(date)&amp;&amp;(cmd.todaybg!=''))
		{ place.style.background = cmd.todaybg; }
	if (config.options.chkShowJulianDate) { // optional display of Julian date numbers
		var m=[0,31,59,90,120,151,181,212,243,273,304,334];
		var d=date.getDate()+m[date.getMonth()];
		var y=date.getFullYear();
		if (date.getMonth()&gt;1 &amp;&amp; (y%4==0 &amp;&amp; y%100!=0) || y%400==0)
			d++; // after February in a leap year
		wikify('@@font-size:80%;&lt;br&gt;'+d+'@@',place);
	}

}
//}}}
//{{{
function isToday(date) // returns true if date is today
	{ var now=new Date(); return ((now-date&gt;=0) &amp;&amp; (now-date&lt;86400000)); }
function isWeekend(date) // returns true if date is a weekend
	{ return (config.macros.date.weekend[date.getDay()]); }
function isHoliday(date) // returns true if date is a holiday
{
	var longHoliday = date.formatString('0MM/0DD/YYYY');
	var shortHoliday = date.formatString('0MM/0DD');
	for(var i = 0; i &lt; config.macros.date.holidays.length; i++) {
		var holiday=config.macros.date.holidays[i];
		if (holiday==longHoliday||holiday==shortHoliday) return true;
	}
	return false;
}
//}}}
//{{{
// Event handler for clicking on a day popup
function onClickDatePopup(e) { e=e||window.event;
	var p=Popup.create(this); if (!p) return false;
	// always show dated tiddler link (or just date, if readOnly) at the top...
	if (!readOnly || store.tiddlerExists(this.date.formatString(this.linkformat)))
		createTiddlyLink(createTiddlyElement(p,'li'),this.date.formatString(this.linkformat),true);
	else
		createTiddlyText(createTiddlyElement(p,'li'),this.date.formatString(this.linkformat));
	if (!config.options.chkDatePopupHideCreated)
		addCreatedsToPopup(p,this.date,this.format);
	if (!config.options.chkDatePopupHideChanged)
		addModifiedsToPopup(p,this.date,this.format);
	if (!config.options.chkDatePopupHideTagged)
		addTaggedToPopup(p,this.date,this.linkformat);
	if (!config.options.chkDatePopupHideReminders)
		addRemindersToPopup(p,this.date,this.linkformat);
	Popup.show(); e.cancelBubble=true; if(e.stopPropagation)e.stopPropagation(); return false;
}
//}}}
//{{{
function indexCreateds() // build list of tiddlers, hash indexed by creation date
{
	var createds= { };
	var tiddlers = store.getTiddlers('title','excludeLists');
	for (var t = 0; t &lt; tiddlers.length; t++) {
		var date = tiddlers[t].created.formatString('YYYY0MM0DD')
		if (!createds[date])
			createds[date]=new Array();
		createds[date].push(tiddlers[t].title);
	}
	return createds;
}
function hasCreateds(date) // returns true if date has created tiddlers
{
	if (!config.macros.date.createds) config.macros.date.createds=indexCreateds();
	return (config.macros.date.createds[date.formatString('YYYY0MM0DD')]!=undefined);
}

function addCreatedsToPopup(p,when,format)
{
	var force=(store.isDirty() &amp;&amp; when.formatString('YYYY0MM0DD')==new Date().formatString('YYYY0MM0DD'));
	if (force || !config.macros.date.createds) config.macros.date.createds=indexCreateds();
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var createds = config.macros.date.createds[when.formatString('YYYY0MM0DD')];
	if (createds) {
		createds.sort();
		var e=createTiddlyElement(p,'div',null,null,'created ('+createds.length+')');
		for(var t=0; t&lt;createds.length; t++) {
			var link=createTiddlyLink(createTiddlyElement(p,'li'),createds[t],false);
			link.appendChild(document.createTextNode(indent+createds[t]));
		}
	}
}
//}}}
//{{{
function indexModifieds() // build list of tiddlers, hash indexed by modification date
{
	var modifieds= { };
	var tiddlers = store.getTiddlers('title','excludeLists');
	for (var t = 0; t &lt; tiddlers.length; t++) {
		var date = tiddlers[t].modified.formatString('YYYY0MM0DD')
		if (!modifieds[date])
			modifieds[date]=new Array();
		modifieds[date].push(tiddlers[t].title);
	}
	return modifieds;
}
function hasModifieds(date) // returns true if date has modified tiddlers
{
	if (!config.macros.date.modifieds) config.macros.date.modifieds = indexModifieds();
	return (config.macros.date.modifieds[date.formatString('YYYY0MM0DD')]!=undefined);
}

function addModifiedsToPopup(p,when,format)
{
	var date=when.formatString('YYYY0MM0DD');
	var force=(store.isDirty() &amp;&amp; date==new Date().formatString('YYYY0MM0DD'));
	if (force || !config.macros.date.modifieds) config.macros.date.modifieds=indexModifieds();
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var mods = config.macros.date.modifieds[date];
	if (mods) {
		// if a tiddler was created on this date, don't list it in the 'changed' section
		if (config.macros.date.createds &amp;&amp; config.macros.date.createds[date]) {
			var temp=[];
			for(var t=0; t&lt;mods.length; t++)
				if (!config.macros.date.createds[date].contains(mods[t]))
					temp.push(mods[t]);
			mods=temp;
		}
		mods.sort();
		var e=createTiddlyElement(p,'div',null,null,'changed ('+mods.length+')');
		for(var t=0; t&lt;mods.length; t++) {
			var link=createTiddlyLink(createTiddlyElement(p,'li'),mods[t],false);
			link.appendChild(document.createTextNode(indent+mods[t]));
		}
	}
}
//}}}
//{{{
function hasTagged(date,format) // returns true if date is tagging other tiddlers
{
	return store.getTaggedTiddlers(date.formatString(format)).length&gt;0;
}

function addTaggedToPopup(p,when,format)
{
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var tagged=store.getTaggedTiddlers(when.formatString(format));
	if (tagged.length) var e=createTiddlyElement(p,'div',null,null,'tagged ('+tagged.length+')');
	for(var t=0; t&lt;tagged.length; t++) {
		var link=createTiddlyLink(createTiddlyElement(p,'li'),tagged[t].title,false);
		link.appendChild(document.createTextNode(indent+tagged[t].title));
	}
}
//}}}
//{{{
function indexReminders(date,leadtime) // build list of tiddlers with reminders, hash indexed by reminder date
{
	var reminders = { };
	if(window.findTiddlersWithReminders!=undefined) { // reminder plugin is installed
		var t = findTiddlersWithReminders(date, [0,leadtime], null, null, 1);
		for(var i=0; i&lt;t.length; i++) reminders[t[i].matchedDate]=true;
	}
	return reminders;
}

function hasReminders(date) // returns true if date has reminders
{
	if (window.reminderCacheForCalendar)
		return window.reminderCacheForCalendar[date]; // use calendar cache
	if (!config.macros.date.reminders)
		config.macros.date.reminders = indexReminders(date,90); // create a 90-day leadtime reminder cache
	return (config.macros.date.reminders[date]);
}

function addRemindersToPopup(p,when,format)
{
	if(window.findTiddlersWithReminders==undefined) return; // reminder plugin not installed

	var indent = String.fromCharCode(160)+String.fromCharCode(160);
	var reminders=findTiddlersWithReminders(when, [0,31],null,null,1);
	createTiddlyElement(p,'div',null,null,'reminders ('+(reminders.length||'none')+')');
	for(var t=0; t&lt;reminders.length; t++) {
		link = createTiddlyLink(createTiddlyElement(p,'li'),reminders[t].tiddler,false);
		var diff=reminders[t].diff;
		diff=(diff&lt;1)?'Today':((diff==1)?'Tomorrow':diff+' days');
		var txt=(reminders[t].params['title'])?reminders[t].params['title']:reminders[t].tiddler;
		link.appendChild(document.createTextNode(indent+diff+' - '+txt));
	}
	if (readOnly) return;	// readonly... omit 'new reminder...' command
	var rem='\\&lt;\\&lt;reminder day:%0 month:%1 year:%2 title:&quot;Enter a reminder title here&quot;\\&gt;\\&gt;';
	rem=rem.format([when.getDate(),when.getMonth()+1,when.getYear()+1900]);
	var cmd=&quot;&lt;&lt;newTiddler label:[[&quot;+indent+&quot;new reminder...]] prompt:[[add a reminder to '%0']]&quot;
		+&quot; title:[[%0]] text:{{var t=store.getTiddlerText('%0','');t+(t.length?'\\n':'')+'%1'}} tag:%2&gt;&gt;&quot;;
	wikify(cmd.format([when.formatString(format),rem,config.options.txtCalendarReminderTags||'']),
		createTiddlyElement(p,'li'));
}
//}}}</pre>
</div>
<div title="DatePluginConfig" modifier="dger" created="201007171404" modified="201009240938" tags="systemConfig plugin pluginConfig %tw-elnb DateExtension">
<pre>/***
|Name|DatePluginConfig|
|Source|http://www.TiddlyTools.com/#DatePluginConfig|
|Documentation|http://www.TiddlyTools.com/#DatePluginInfo|
|Version|2.6.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|formats, background colors and other optional settings for DatePlugin|
***/
// // Default popup content display options (can be overridden by cookies)
//{{{
if (config.options.chkDatePopupHideCreated===undefined)
	config.options.chkDatePopupHideCreated=false;
if (config.options.chkDatePopupHideChanged===undefined)
	config.options.chkDatePopupHideChanged=false;
if (config.options.chkDatePopupHideTagged===undefined)
	config.options.chkDatePopupHideTagged=false;
if (config.options.chkDatePopupHideReminders===undefined)
	config.options.chkDatePopupHideReminders=false;
//}}}

// // show Julian date number below regular date
//{{{
if (config.options.chkShowJulianDate===undefined)
	config.options.chkShowJulianDate=false;
//}}}

// // fixed-date annual holidays
//{{{
config.macros.date.holidays=[
	&quot;01/01&quot;, // NewYearsDay, 
	&quot;07/04&quot;, // US Independence Day
	&quot;07/24&quot;  // Eric's Birthday (hooray!)
];
//}}}

// // weekend map (1=weekend, 0=weekday)
//{{{
config.macros.date.weekend=[ 1,0,0,0,0,0,1 ]; // day index values: sun=0, mon=1, tue=2, wed=3, thu=4, fri=5, sat=6
//}}}

// // date display/link formats
//{{{
config.macros.date.format=&quot;YYYY.0MM.0DD&quot;; // default date display format
config.macros.date.linkformat=&quot;YYYY.0MM.0DD&quot;; // 'dated tiddler' link format
//}}}

// // When displaying a calendar (see [[CalendarPlugin]]), you can customize the colors/styles that are applied to the calendar dates by modifying the values and/or functions below:
//{{{
// default calendar colors
config.macros.date.weekendbg=&quot;#c0c0c0&quot;;
config.macros.date.holidaybg=&quot;#ffaace&quot;;
config.macros.date.createdbg=&quot;#bbeeff&quot;;
config.macros.date.modifiedsbg=&quot;#bbeeff&quot;;
config.macros.date.linkedbg=&quot;#babb1e&quot;;
config.macros.date.remindersbg=&quot;#c0ffee&quot;;

// apply calendar styles
function setDateStyle(place,link,weekend) {
	// alias variable names for code readability
	var date=link.date;
	var fmt=link.linkformat;
	var linkto=date.formatString(fmt);
	var cmd=config.macros.date;

	if ((weekend!==undefined?weekend:isWeekend(date))&amp;&amp;(cmd.weekendbg!=&quot;&quot;))
		{ place.style.background = cmd.weekendbg; }
	if (hasModifieds(date)||hasCreateds(date)||hasTagged(date,fmt))
		{ link.style.fontStyle=&quot;normal&quot;; link.style.fontWeight=&quot;bold&quot;; }
	if (hasReminders(date))
		{ link.style.textDecoration=&quot;underline&quot;; }
	if (isToday(date))
		{ link.style.border=&quot;1px solid black&quot;; }
	if (isHoliday(date)&amp;&amp;(cmd.holidaybg!=&quot;&quot;))
		{ place.style.background = cmd.holidaybg; }
	if (hasCreateds(date)&amp;&amp;(cmd.createdbg!=&quot;&quot;))
		{ place.style.background = cmd.createdbg; }
	if (hasModifieds(date)&amp;&amp;(cmd.modifiedsbg!=&quot;&quot;))
		{ place.style.background = cmd.modifiedsbg; }
	if ((hasTagged(date,fmt)||store.tiddlerExists(linkto))&amp;&amp;(cmd.linkedbg!=&quot;&quot;))
		{ place.style.background = cmd.linkedbg; }
	if (hasReminders(date)&amp;&amp;(cmd.remindersbg!=&quot;&quot;))
		{ place.style.background = cmd.remindersbg; }
	if (isToday(date)&amp;&amp;(cmd.todaybg!=&quot;&quot;))
		{ place.style.background = cmd.todaybg; }
	if (config.options.chkShowJulianDate) {
		var m=[0,31,59,90,120,151,181,212,243,273,304,334];
		var d=date.getDate()+m[date.getMonth()];
		var y=date.getFullYear();
		if (date.getMonth()&gt;1 &amp;&amp; (y%4==0 &amp;&amp; y%100!=0) || y%400==0) d++; // after February in a leap year
		wikify(&quot;@@font-size:80%;&lt;br&gt;&quot;+d+&quot;@@&quot;,place);
	}
	var t=store.getTiddlerText(linkto,'')
	if (config.options.chkInlineCalendarJournals &amp;&amp; t.length) wikify('&lt;br&gt;'+t,place);
}
//}}}</pre>
</div>
<div title="DisableWikiLinksPlugin" modifier="escdie" created="201008201609" modified="201011101810" tags="systemConfig plugin pluginInfo %tw-elnb">
<pre>/***
|Name|DisableWikiLinksPlugin|
|Source|http://www.TiddlyTools.com/#DisableWikiLinksPlugin|
|Version|1.6.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|selectively disable TiddlyWiki's automatic ~WikiWord linking behavior|
This plugin allows you to disable TiddlyWiki's automatic ~WikiWord linking behavior, so that WikiWords embedded in tiddler content will be rendered as regular text, instead of being automatically converted to tiddler links.  To create a tiddler link when automatic linking is disabled, you must enclose the link text within {{{[[...]]}}}.
!!!!!Usage
&lt;&lt;&lt;
You can block automatic WikiWord linking behavior for any specific tiddler by ''tagging it with&lt;&lt;tag excludeWikiWords&gt;&gt;'' (see configuration below) or, check a plugin option to disable automatic WikiWord links to non-existing tiddler titles, while still linking WikiWords that correspond to existing tiddlers titles or shadow tiddler titles.  You can also block specific selected WikiWords from being automatically linked by listing them in [[DisableWikiLinksList]] (see configuration below), separated by whitespace.  This tiddler is optional and, when present, causes the listed words to always be excluded, even if automatic linking of other WikiWords is being permitted.  

Note: WikiWords contained in default ''shadow'' tiddlers will be automatically linked unless you select an additional checkbox option lets you disable these automatic links as well, though this is not recommended, since it can make it more difficult to access some TiddlyWiki standard default content (such as AdvancedOptions or SideBarTabs)
&lt;&lt;&lt;
!!!!!Configuration
&lt;&lt;&lt;
&lt;&lt;option chkDisableWikiLinks&gt;&gt; Disable ALL automatic WikiWord tiddler links
&lt;&lt;option chkAllowLinksFromShadowTiddlers&gt;&gt; ... except for WikiWords //contained in// shadow tiddlers
&lt;&lt;option chkDisableNonExistingWikiLinks&gt;&gt; Disable automatic WikiWord links for non-existing tiddlers
Disable automatic WikiWord links for words listed in: &lt;&lt;option txtDisableWikiLinksList&gt;&gt;
Disable automatic WikiWord links for tiddlers tagged with: &lt;&lt;option txtDisableWikiLinksTag&gt;&gt;
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2008.07.22 [1.6.0] hijack tiddler changed() method to filter disabled wiki words from internal links[] array (so they won't appear in the missing tiddlers list)
2007.06.09 [1.5.0] added configurable txtDisableWikiLinksTag (default value: &quot;excludeWikiWords&quot;) to allows selective disabling of automatic WikiWord links for any tiddler tagged with that value.
2006.12.31 [1.4.0] in formatter, test for chkDisableNonExistingWikiLinks
2006.12.09 [1.3.0] in formatter, test for excluded wiki words specified in DisableWikiLinksList
2006.12.09 [1.2.2] fix logic in autoLinkWikiWords() (was allowing links TO shadow tiddlers, even when chkDisableWikiLinks is TRUE).  
2006.12.09 [1.2.1] revised logic for handling links in shadow content
2006.12.08 [1.2.0] added hijack of Tiddler.prototype.autoLinkWikiWords so regular (non-bracketed) WikiWords won't be added to the missing list
2006.05.24 [1.1.0] added option to NOT bypass automatic wikiword links when displaying default shadow content (default is to auto-link shadow content)
2006.02.05 [1.0.1] wrapped wikifier hijack in init function to eliminate globals and avoid FireFox 1.5.0.1 crash bug when referencing globals
2005.12.09 [1.0.0] initial release
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.DisableWikiLinksPlugin= {major: 1, minor: 6, revision: 0, date: new Date(2008,7,22)};

if (config.options.chkDisableNonExistingWikiLinks==undefined) config.options.chkDisableNonExistingWikiLinks= false;
if (config.options.chkDisableWikiLinks==undefined) config.options.chkDisableWikiLinks=false;
if (config.options.txtDisableWikiLinksList==undefined) config.options.txtDisableWikiLinksList=&quot;DisableWikiLinksList&quot;;
if (config.options.chkAllowLinksFromShadowTiddlers==undefined) config.options.chkAllowLinksFromShadowTiddlers=true;
if (config.options.txtDisableWikiLinksTag==undefined) config.options.txtDisableWikiLinksTag=&quot;excludeWikiWords&quot;;

// find the formatter for wikiLink and replace handler with 'pass-thru' rendering
initDisableWikiLinksFormatter();
function initDisableWikiLinksFormatter() {
	for (var i=0; i&lt;config.formatters.length &amp;&amp; config.formatters[i].name!=&quot;wikiLink&quot;; i++);
	config.formatters[i].coreHandler=config.formatters[i].handler;
	config.formatters[i].handler=function(w) {
		// supress any leading &quot;~&quot; (if present)
		var skip=(w.matchText.substr(0,1)==config.textPrimitives.unWikiLink)?1:0;
		var title=w.matchText.substr(skip);
		var exists=store.tiddlerExists(title);
		var inShadow=w.tiddler &amp;&amp; store.isShadowTiddler(w.tiddler.title);
		// check for excluded Tiddler
		if (w.tiddler &amp;&amp; w.tiddler.isTagged(config.options.txtDisableWikiLinksTag))
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// check for specific excluded wiki words
		var t=store.getTiddlerText(config.options.txtDisableWikiLinksList);
		if (t &amp;&amp; t.length &amp;&amp; t.indexOf(w.matchText)!=-1)
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// if not disabling links from shadows (default setting)
		if (config.options.chkAllowLinksFromShadowTiddlers &amp;&amp; inShadow)
			return this.coreHandler(w);
		// check for non-existing non-shadow tiddler
		if (config.options.chkDisableNonExistingWikiLinks &amp;&amp; !exists)
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// if not enabled, just do standard WikiWord link formatting
		if (!config.options.chkDisableWikiLinks)
			return this.coreHandler(w);
		// just return text without linking
		w.outputText(w.output,w.matchStart+skip,w.nextMatch)
	}
}

Tiddler.prototype.coreAutoLinkWikiWords = Tiddler.prototype.autoLinkWikiWords;
Tiddler.prototype.autoLinkWikiWords = function()
{
	// if all automatic links are not disabled, just return results from core function
	if (!config.options.chkDisableWikiLinks)
		return this.coreAutoLinkWikiWords.apply(this,arguments);
	return false;
}

Tiddler.prototype.disableWikiLinks_changed = Tiddler.prototype.changed;
Tiddler.prototype.changed = function()
{
	this.disableWikiLinks_changed.apply(this,arguments);
	// remove excluded wiki words from links array
	var t=store.getTiddlerText(config.options.txtDisableWikiLinksList,&quot;&quot;).readBracketedList();
	if (t.length) for (var i=0; i&lt;t.length; i++)
		if (this.links.contains(t[i]))
			this.links.splice(this.links.indexOf(t[i]),1);
};
//}}}</pre>
</div>
<div title="ExportTiddlersPlugin" modifier="dger" created="201009101358" modified="201009301853" tags="systemConfig ImportExportPackage plugin %tw-elnb">
<pre>/***
|Name|ExportTiddlersPlugin|
|Source|http://www.TiddlyTools.com/#ExportTiddlersPlugin|
|Documentation|http://www.TiddlyTools.com/#ExportTiddlersPluginInfo|
|Version|2.9.5|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|interactively select/export tiddlers to a separate file|
!!!!!Documentation
&gt;see [[ExportTiddlersPluginInfo]]
!!!!!Inline control panel (live):
&gt;&lt;&lt;exportTiddlers inline&gt;&gt;
!!!!!Revisions
&lt;&lt;&lt;
2010.02.25 2.9.5 added merge checkbox option and improved 'merge' status message
|please see [[ExportTiddlersPluginInfo]] for additional revision details|
2005.10.09 0.0.0 development started
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
// version
version.extensions.ExportTiddlersPlugin= {major: 2, minor: 9, revision: 5, date: new Date(2010,2,25)};

// default shadow definition
config.shadowTiddlers.ExportTiddlers='&lt;&lt;exportTiddlers inline&gt;&gt;';

// add 'export' backstage task (following built-in import task)
if (config.tasks) { // TW2.2 or above
	config.tasks.exportTask = {
		text:'export',
		tooltip:'Export selected tiddlers to another file',
		content:'&lt;&lt;exportTiddlers inline&gt;&gt;'
	}
	config.backstageTasks.splice(config.backstageTasks.indexOf('importTask')+1,0,'exportTask');
}

config.macros.exportTiddlers = {
	$: function(id) { return document.getElementById(id); }, // abbreviation
	label: 'export tiddlers',
	prompt: 'Copy selected tiddlers to an export document',
	okmsg: '%0 tiddler%1 written to %2',
	failmsg: 'An error occurred while creating %1',
	overwriteprompt: '%0\ncontains %1 tiddler%2 that will be discarded or replaced',
	mergestatus: '%0 tiddler%1 added, %2 tiddler%3 updated, %4 tiddler%5 unchanged',
	statusmsg: '%0 tiddler%1 - %2 selected for export',
	newdefault: 'export.html',
	datetimefmt: '0MM/0DD/YYYY 0hh:0mm:0ss',  // for 'filter date/time' edit fields
	type_TW: &quot;tw&quot;, type_PS: &quot;ps&quot;, type_TX: &quot;tx&quot;, type_CS: &quot;cs&quot;, type_NF: &quot;nf&quot;, // file type tokens
	type_map: { // maps type param to token values
		tiddlywiki:&quot;tw&quot;, tw:&quot;tw&quot;, wiki: &quot;tw&quot;,
		purestore: &quot;ps&quot;, ps:&quot;ps&quot;, store:&quot;ps&quot;,
		plaintext: &quot;tx&quot;, tx:&quot;tx&quot;, text: &quot;tx&quot;,
		comma:     &quot;cs&quot;, cs:&quot;cs&quot;, csv:  &quot;cs&quot;,
		newsfeed:  &quot;nf&quot;, nf:&quot;nf&quot;, xml:  &quot;nf&quot;, rss:&quot;nf&quot;
	},
	handler: function(place,macroName,params) {
		if (params[0]!='inline')
			{ createTiddlyButton(place,this.label,this.prompt,this.togglePanel); return; }
		var panel=this.createPanel(place);
		panel.style.position='static';
		panel.style.display='block';
	},
	createPanel: function(place) {
		var panel=this.$('exportPanel');
		if (panel) { panel.parentNode.removeChild(panel); }
		setStylesheet(store.getTiddlerText('ExportTiddlersPlugin##css',''),'exportTiddlers');
		panel=createTiddlyElement(place,'span','exportPanel',null,null)
		panel.innerHTML=store.getTiddlerText('ExportTiddlersPlugin##html','');
		this.initFilter();
		this.refreshList(0);
		var fn=this.$('exportFilename');
		if (window.location.protocol=='file:' &amp;&amp; !fn.value.length) {
			// get new target path/filename
			var newPath=getLocalPath(window.location.href);
			var slashpos=newPath.lastIndexOf('/'); if (slashpos==-1) slashpos=newPath.lastIndexOf('\\'); 
			if (slashpos!=-1) newPath=newPath.substr(0,slashpos+1); // trim filename
			fn.value=newPath+this.newdefault;
		}
		return panel;
	},
	togglePanel: function(e) { var e=e||window.event;
		var cme=config.macros.exportTiddlers; // abbrev
		var parent=resolveTarget(e).parentNode;
		var panel=cme.$('exportPanel');
		if (panel==undefined || panel.parentNode!=parent)
			panel=cme.createPanel(parent);
		var isOpen=panel.style.display=='block';
		if(config.options.chkAnimate)
			anim.startAnimating(new Slider(panel,!isOpen,e.shiftKey || e.altKey,'none'));
		else
			panel.style.display=isOpen?'none':'block' ;
		if (panel.style.display!='none') {
			cme.refreshList(0);
			cme.$('exportFilename').focus(); 
			cme.$('exportFilename').select();
		}
		e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); return(false);
	},
	process: function(which) { // process panel control interactions
		var theList=this.$('exportList'); if (!theList) return false;
		var count = 0;
		var total = store.getTiddlers('title').length;
		switch (which.id) {
			case 'exportFilter':
				count=this.filterExportList();
				var panel=this.$('exportFilterPanel');
				if (count==-1) { panel.style.display='block'; break; }
				this.$('exportStart').disabled=(count==0);
				this.$('exportDelete').disabled=(count==0);
				this.displayStatus(count,total);
				if (count==0) { alert('No tiddlers were selected'); panel.style.display='block'; }
				break;
			case 'exportStart':
				this.go();
				break;
			case 'exportDelete':
				this.deleteTiddlers();
				break;
			case 'exportHideFilter':
			case 'exportToggleFilter':
				var panel=this.$('exportFilterPanel')
				panel.style.display=(panel.style.display=='block')?'none':'block';
				break;
			case 'exportSelectChanges':
				var lastmod=new Date(document.lastModified);
				for (var t = 0; t &lt; theList.options.length; t++) {
					if (theList.options[t].value=='') continue;
					var tiddler=store.getTiddler(theList.options[t].value); if (!tiddler) continue;
					theList.options[t].selected=(tiddler.modified&gt;lastmod);
					count += (tiddler.modified&gt;lastmod)?1:0;
				}
				this.$('exportStart').disabled=(count==0);
				this.$('exportDelete').disabled=(count==0);
				this.displayStatus(count,total);
				if (count==0) alert('There are no unsaved changes');
				break;
			case 'exportSelectAll':
				for (var t = 0; t &lt; theList.options.length; t++) {
					if (theList.options[t].value=='') continue;
					theList.options[t].selected=true;
					count += 1;
				}
				this.$('exportStart').disabled=(count==0);
				this.$('exportDelete').disabled=(count==0);
				this.displayStatus(count,count);
				break;
			case 'exportSelectOpened':
				for (var t=0; t&lt;theList.options.length; t++) theList.options[t].selected=false;
				var tiddlerDisplay=this.$('tiddlerDisplay');
				for (var t=0; t&lt;tiddlerDisplay.childNodes.length;t++) {
					var tiddler=tiddlerDisplay.childNodes[t].id.substr(7);
					for (var i=0; i&lt;theList.options.length; i++) {
						if (theList.options[i].value!=tiddler) continue;
						theList.options[i].selected=true; count++; break;
					}
				}
				this.$('exportStart').disabled=(count==0);
				this.$('exportDelete').disabled=(count==0);
				this.displayStatus(count,total);
				if (count==0) alert('There are no tiddlers currently opened');
				break;
			case 'exportSelectRelated':
				// recursively build list of related tiddlers
				function getRelatedTiddlers(tid,tids) {
					var t=store.getTiddler(tid); if (!t || tids.contains(tid)) return tids;
					tids.push(t.title);
					if (!t.linksUpdated) t.changed();
					for (var i=0; i&lt;t.links.length; i++)
						if (t.links[i]!=tid) tids=getRelatedTiddlers(t.links[i],tids);
					return tids;
				}
				// for all currently selected tiddlers, gather up the related tiddlers (including self) and select them as well
				var tids=[];
				for (var i=0; i&lt;theList.options.length; i++)
					if (theList.options[i].selected) tids=getRelatedTiddlers(theList.options[i].value,tids);
				// select related tiddlers (includes original selected tiddlers)
				for (var i=0; i&lt;theList.options.length; i++)
					theList.options[i].selected=tids.contains(theList.options[i].value);
				this.displayStatus(tids.length,total);
				break;
			case 'exportListSmaller':	// decrease current listbox size
				var min=5;
				theList.size-=(theList.size&gt;min)?1:0;
				break;
			case 'exportListLarger':	// increase current listbox size
				var max=(theList.options.length&gt;25)?theList.options.length:25;
				theList.size+=(theList.size&lt;max)?1:0;
				break;
			case 'exportClose':
				this.$('exportPanel').style.display='none';
				break;
		}
		return false;
	},
	displayStatus: function(count,total) {
		var txt=this.statusmsg.format([total,total!=1?'s':'',!count?'none':count==total?'all':count]);
		clearMessage();	displayMessage(txt);
		return txt;
	},
	refreshList: function(selectedIndex) {
		var theList = this.$('exportList'); if (!theList) return;
		// get the sort order
		var sort;
		if (!selectedIndex)   selectedIndex=0;
		if (selectedIndex==0) sort='modified';
		if (selectedIndex==1) sort='title';
		if (selectedIndex==2) sort='modified';
		if (selectedIndex==3) sort='modifier';
		if (selectedIndex==4) sort='tags';

		// unselect headings and count number of tiddlers actually selected
		var count=0;
		for (var t=5; t &lt; theList.options.length; t++) {
			if (!theList.options[t].selected) continue;
			if (theList.options[t].value!='')
				count++;
			else { // if heading is selected, deselect it, and then select and count all in section
				theList.options[t].selected=false;
				for ( t++; t&lt;theList.options.length &amp;&amp; theList.options[t].value!=''; t++) {
					theList.options[t].selected=true;
					count++;
				}
			}
		}

		// disable 'export' and 'delete' buttons if no tiddlers selected
		this.$('exportStart').disabled=(count==0);
		this.$('exportDelete').disabled=(count==0);

		// show selection count
		var tiddlers = store.getTiddlers('title');
		if (theList.options.length) this.displayStatus(count,tiddlers.length);

		// if a [command] item, reload list... otherwise, no further refresh needed
		if (selectedIndex&gt;4) return;

		// clear current list contents
		while (theList.length &gt; 0) { theList.options[0] = null; }
		// add heading and control items to list
		var i=0;
		var indent=String.fromCharCode(160)+String.fromCharCode(160);
		theList.options[i++]=
			new Option(tiddlers.length+' tiddlers in document', '',false,false);
		theList.options[i++]=
			new Option(((sort=='title'   )?'&gt;':indent)+' [by title]', '',false,false);
		theList.options[i++]=
			new Option(((sort=='modified')?'&gt;':indent)+' [by date]', '',false,false);
		theList.options[i++]=
			new Option(((sort=='modifier')?'&gt;':indent)+' [by author]', '',false,false);
		theList.options[i++]=
			new Option(((sort=='tags'    )?'&gt;':indent)+' [by tags]', '',false,false);

		// output the tiddler list
		switch(sort) {
			case 'title':
				for(var t = 0; t &lt; tiddlers.length; t++)
					theList.options[i++] = new Option(tiddlers[t].title,tiddlers[t].title,false,false);
				break;
			case 'modifier':
			case 'modified':
				var tiddlers = store.getTiddlers(sort);
				// sort descending for newest date first
				tiddlers.sort(function (a,b) {if(a[sort] == b[sort]) return(0); else return (a[sort] &gt; b[sort]) ? -1 : +1; });
				var lastSection = '';
				for(var t = 0; t &lt; tiddlers.length; t++) {
					var tiddler = tiddlers[t];
					var theSection = '';
					if (sort=='modified') theSection=tiddler.modified.toLocaleDateString();
					if (sort=='modifier') theSection=tiddler.modifier;
					if (theSection != lastSection) {
						theList.options[i++] = new Option(theSection,'',false,false);
						lastSection = theSection;
					}
					theList.options[i++] = new Option(indent+indent+tiddler.title,tiddler.title,false,false);
				}
				break;
			case 'tags':
				var theTitles = {}; // all tiddler titles, hash indexed by tag value
				var theTags = new Array();
				for(var t=0; t&lt;tiddlers.length; t++) {
					var title=tiddlers[t].title;
					var tags=tiddlers[t].tags;
					if (!tags || !tags.length) {
						if (theTitles['untagged']==undefined) { theTags.push('untagged'); theTitles['untagged']=new Array(); }
						theTitles['untagged'].push(title);
					}
					else for(var s=0; s&lt;tags.length; s++) {
						if (theTitles[tags[s]]==undefined) { theTags.push(tags[s]); theTitles[tags[s]]=new Array(); }
						theTitles[tags[s]].push(title);
					}
				}
				theTags.sort();
				for(var tagindex=0; tagindex&lt;theTags.length; tagindex++) {
					var theTag=theTags[tagindex];
					theList.options[i++]=new Option(theTag,'',false,false);
					for(var t=0; t&lt;theTitles[theTag].length; t++)
						theList.options[i++]=new Option(indent+indent+theTitles[theTag][t],theTitles[theTag][t],false,false);
				}
				break;
			}
		theList.selectedIndex=selectedIndex; // select current control item
		this.$('exportStart').disabled=true;
		this.$('exportDelete').disabled=true;
		this.displayStatus(0,tiddlers.length);
	},
	askForFilename: function(here) {
		var msg=here.title; // use tooltip as dialog box message
		var path=getLocalPath(document.location.href);
		var slashpos=path.lastIndexOf('/'); if (slashpos==-1) slashpos=path.lastIndexOf('\\'); 
		if (slashpos!=-1) path = path.substr(0,slashpos+1); // remove filename from path, leave the trailing slash
		var filetype=this.$('exportFormat').value.toLowerCase();
		var defext='html';
		if (filetype==this.type_TX) defext='txt';
		if (filetype==this.type_CS) defext='csv';
		if (filetype==this.type_NF) defext='xml';
		var file=this.newdefault.replace(/html$/,defext);
		var result='';
		if(window.Components) { // moz
			try {
				netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
				var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
				var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
				picker.init(window, msg, nsIFilePicker.modeSave);
				var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
				thispath.initWithPath(path);
				picker.displayDirectory=thispath;
				picker.defaultExtension=defext;
				picker.defaultString=file;
				picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
				if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
			}
			catch(e) { alert('error during local file access: '+e.toString()) }
		}
		else { // IE
			try { // XPSP2 IE only
				var s = new ActiveXObject('UserAccounts.CommonDialog');
				s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|XML files|*.xml|';
				s.FilterIndex=defext=='txt'?2:'html'?3:'xml'?4:1;
				s.InitialDir=path;
				s.FileName=file;
				if (s.showOpen()) var result=s.FileName;
			}
			catch(e) {  // fallback
				var result=prompt(msg,path+file);
			}
		}
		return result;
	},
	initFilter: function() {
		this.$('exportFilterStart').checked=false; this.$('exportStartDate').value='';
		this.$('exportFilterEnd').checked=false;  this.$('exportEndDate').value='';
		this.$('exportFilterTags').checked=false; this.$('exportTags').value='';
		this.$('exportFilterText').checked=false; this.$('exportText').value='';
		this.showFilterFields();
	},
	showFilterFields: function(which) {
		var show=this.$('exportFilterStart').checked;
		this.$('exportFilterStartBy').style.display=show?'block':'none';
		this.$('exportStartDate').style.display=show?'block':'none';
		var val=this.$('exportFilterStartBy').value;
		this.$('exportStartDate').value
			=this.getFilterDate(val,'exportStartDate').formatString(this.datetimefmt);
		if (which &amp;&amp; (which.id=='exportFilterStartBy') &amp;&amp; (val=='other'))
			this.$('exportStartDate').focus();

		var show=this.$('exportFilterEnd').checked;
		this.$('exportFilterEndBy').style.display=show?'block':'none';
		this.$('exportEndDate').style.display=show?'block':'none';
		var val=this.$('exportFilterEndBy').value;
		this.$('exportEndDate').value
			=this.getFilterDate(val,'exportEndDate').formatString(this.datetimefmt);
		 if (which &amp;&amp; (which.id=='exportFilterEndBy') &amp;&amp; (val=='other'))
			this.$('exportEndDate').focus();

		var show=this.$('exportFilterTags').checked;
		this.$('exportTags').style.display=show?'block':'none';

		var show=this.$('exportFilterText').checked;
		this.$('exportText').style.display=show?'block':'none';
	},
	getFilterDate: function(val,id) {
		var result=0;
		switch (val) {
			case 'file':
				result=new Date(document.lastModified);
				break;
			case 'other':
				result=new Date(this.$(id).value);
				break;
			default: // today=0, yesterday=1, one week=7, two weeks=14, a month=31
				var now=new Date(); var tz=now.getTimezoneOffset()*60000; now-=tz;
				var oneday=86400000;
				if (id=='exportStartDate')
					result=new Date((Math.floor(now/oneday)-val)*oneday+tz);
				else
					result=new Date((Math.floor(now/oneday)-val+1)*oneday+tz-1);
				break;
		}
		return result;
	},
	filterExportList: function() {
		var theList  = this.$('exportList'); if (!theList) return -1;
		var filterStart=this.$('exportFilterStart').checked;
		var val=this.$('exportFilterStartBy').value;
		var startDate=config.macros.exportTiddlers.getFilterDate(val,'exportStartDate');
		var filterEnd=this.$('exportFilterEnd').checked;
		var val=this.$('exportFilterEndBy').value;
		var endDate=config.macros.exportTiddlers.getFilterDate(val,'exportEndDate');
		var filterTags=this.$('exportFilterTags').checked;
		var tags=this.$('exportTags').value;
		var filterText=this.$('exportFilterText').checked;
		var text=this.$('exportText').value;
		if (!(filterStart||filterEnd||filterTags||filterText)) {
			alert('Please set the selection filter');
			this.$('exportFilterPanel').style.display='block';
			return -1;
		}
		if (filterStart&amp;&amp;filterEnd&amp;&amp;(startDate&gt;endDate)) {
			var msg='starting date/time:\n'
			msg+=startDate.toLocaleString()+'\n';
			msg+='is later than ending date/time:\n'
			msg+=endDate.toLocaleString()
			alert(msg);
			return -1;
		}
		// if filter by tags, get list of matching tiddlers
		// use getMatchingTiddlers() (if MatchTagsPlugin is installed) for full boolean expressions
		// otherwise use getTaggedTiddlers() for simple tag matching
		if (filterTags) {
			var fn=store.getMatchingTiddlers||store.getTaggedTiddlers;
			var t=fn.apply(store,[tags]);
			var tagged=[];
			for (var i=0; i&lt;t.length; i++) tagged.push(t[i].title);
		}
		// scan list and select tiddlers that match all applicable criteria
		var total=0;
		var count=0;
		for (var i=0; i&lt;theList.options.length; i++) {
			// get item, skip non-tiddler list items (section headings)
			var opt=theList.options[i]; if (opt.value=='') continue;
			// get tiddler, skip missing tiddlers (this should NOT happen)
			var tiddler=store.getTiddler(opt.value); if (!tiddler) continue; 
			var sel=true;
			if ( (filterStart &amp;&amp; tiddler.modified&lt;startDate)
			|| (filterEnd &amp;&amp; tiddler.modified&gt;endDate)
			|| (filterTags &amp;&amp; !tagged.contains(tiddler.title))
			|| (filterText &amp;&amp; (tiddler.text.indexOf(text)==-1) &amp;&amp; (tiddler.title.indexOf(text)==-1)))
				sel=false;
			opt.selected=sel;
			count+=sel?1:0;
			total++;
		}
		return count;
	},
	deleteTiddlers: function() {
		var list=this.$('exportList'); if (!list) return;
		var tids=[];
		for (i=0;i&lt;list.length;i++)
			if (list.options[i].selected &amp;&amp; list.options[i].value.length)
				tids.push(list.options[i].value);
		if (!confirm('Are you sure you want to delete these tiddlers:\n\n'+tids.join(', '))) return;
		store.suspendNotifications();
		for (t=0;t&lt;tids.length;t++) {
			var tid=store.getTiddler(tids[t]); if (!tid) continue;
			var msg=&quot;'&quot;+tid.title+&quot;' is tagged with 'systemConfig'.\n\n&quot;;
			msg+='Removing this tiddler may cause unexpected results.  Are you sure?'
			if (tid.tags.contains('systemConfig') &amp;&amp; !confirm(msg)) continue;
			store.removeTiddler(tid.title);
			story.closeTiddler(tid.title);
		}
		store.resumeNotifications();
		alert(tids.length+' tiddlers deleted');
		this.refreshList(0); // reload listbox
		store.notifyAll(); // update page display
	},
	go: function() {
		if (window.location.protocol!='file:') // make sure we are local
			{ displayMessage(config.messages.notFileUrlError); return; }
		// get selected tidders, target filename, target type, and notes
		var list=this.$('exportList'); if (!list) return;
		var tids=[]; for (var i=0; i&lt;list.options.length; i++) {
			var opt=list.options[i]; if (!opt.selected||!opt.value.length) continue;
			var tid=store.getTiddler(opt.value); if (!tid) continue;
			tids.push(tid);
		}
		if (!tids.length) return; // no tiddlers selected
		var target=this.$('exportFilename').value.trim();
		if (!target.length) {
			displayMessage('A local target path/filename is required',target);
			return;
		}
		var merge=this.$('exportMerge').checked;
		var filetype=this.$('exportFormat').value.toLowerCase();
		var notes=this.$('exportNotes').value.replace(/\n/g,'&lt;br&gt;');
		var total={val:0};
		var out=this.assembleFile(target,filetype,tids,notes,total,merge);
		if (!total.val) return; // cancelled file overwrite
		var link='file:///'+target.replace(/\\/g,'/');
		var samefile=link==decodeURIComponent(window.location.href);
		var p=getLocalPath(document.location.href);
		if (samefile) {
			if (config.options.chkSaveBackups) { var t=loadOriginal(p);if(t)saveBackup(p,t); }
			if (config.options.chkGenerateAnRssFeed &amp;&amp; saveRss instanceof Function) saveRss(p);
		}
		var ok=saveFile(target,out);
		displayMessage((ok?this.okmsg:this.failmsg).format([total.val,total.val!=1?'s':'',target]),link);
	},
	plainTextHeader:
		 'Source:\n\t%0\n'
		+'Title:\n\t%1\n'
		+'Subtitle:\n\t%2\n'
		+'Created:\n\t%3 by %4\n'
		+'Application:\n\tTiddlyWiki %5 / %6 %7\n\n',
	plainTextTiddler:
		'- - - - - - - - - - - - - - -\n'
		+'|     title: %0\n'
		+'|   created: %1\n'
		+'|  modified: %2\n'
		+'| edited by: %3\n'
		+'|      tags: %4\n'
		+'- - - - - - - - - - - - - - -\n'
		+'%5\n',
	plainTextFooter:
		'',
	newsFeedHeader:
		 '&lt;'+'?xml version=&quot;1.0&quot;?'+'&gt;\n'
		+'&lt;rss version=&quot;2.0&quot;&gt;\n'
		+'&lt;channel&gt;\n'
		+'&lt;title&gt;%1&lt;/title&gt;\n'
		+'&lt;link&gt;%0&lt;/link&gt;\n'
		+'&lt;description&gt;%2&lt;/description&gt;\n'
		+'&lt;language&gt;en-us&lt;/language&gt;\n'
		+'&lt;copyright&gt;Copyright '+(new Date().getFullYear())+' %4&lt;/copyright&gt;\n'
		+'&lt;pubDate&gt;%3&lt;/pubDate&gt;\n'
		+'&lt;lastBuildDate&gt;%3&lt;/lastBuildDate&gt;\n'
		+'&lt;docs&gt;http://blogs.law.harvard.edu/tech/rss&lt;/docs&gt;\n'
		+'&lt;generator&gt;TiddlyWiki %5 / %6 %7&lt;/generator&gt;\n',
	newsFeedTiddler:
		'\n%0\n',
	newsFeedFooter:
		'&lt;/channel&gt;&lt;/rss&gt;',
	pureStoreHeader:
		 '&lt;html&gt;&lt;body&gt;'
		+'&lt;style type=&quot;text/css&quot;&gt;'
		+'	#storeArea {display:block;margin:1em;}'
		+'	#storeArea div {padding:0.5em;margin:1em;border:2px solid black;height:10em;overflow:auto;}'
		+'	#pureStoreHeading {width:100%;text-align:left;background-color:#eeeeee;padding:1em;}'
		+'&lt;/style&gt;'
		+'&lt;div id=&quot;pureStoreHeading&quot;&gt;'
		+'	TiddlyWiki &quot;PureStore&quot; export file&lt;br&gt;'
		+'	Source'+': &lt;b&gt;%0&lt;/b&gt;&lt;br&gt;'
		+'	Title: &lt;b&gt;%1&lt;/b&gt;&lt;br&gt;'
		+'	Subtitle: &lt;b&gt;%2&lt;/b&gt;&lt;br&gt;'
		+'	Created: &lt;b&gt;%3&lt;/b&gt; by &lt;b&gt;%4&lt;/b&gt;&lt;br&gt;'
		+'	TiddlyWiki %5 / %6 %7&lt;br&gt;'
		+'	Notes:&lt;hr&gt;&lt;pre&gt;%8&lt;/pre&gt;'
		+'&lt;/div&gt;'
		+'&lt;div id=&quot;storeArea&quot;&gt;',
	pureStoreTiddler:
		'%0\n%1',
	pureStoreFooter:
		'&lt;/div&gt;&lt;!--POST-BODY-START--&gt;\n&lt;!--POST-BODY-END--&gt;&lt;/body&gt;&lt;/html&gt;',
	assembleFile: function(target,filetype,tids,notes,total,merge) {
		var revised='';
		var now = new Date().toLocaleString();
		var src=convertUnicodeToUTF8(document.location.href);
		var title = convertUnicodeToUTF8(wikifyPlain('SiteTitle').htmlEncode());
		var subtitle = convertUnicodeToUTF8(wikifyPlain('SiteSubtitle').htmlEncode());
		var user = convertUnicodeToUTF8(config.options.txtUserName.htmlEncode());
		var twver = version.major+'.'+version.minor+'.'+version.revision;
		var v=version.extensions.ExportTiddlersPlugin; var pver = v.major+'.'+v.minor+'.'+v.revision;
		var headerargs=[src,title,subtitle,now,user,twver,'ExportTiddlersPlugin',pver,notes];
		switch (filetype) {
			case this.type_TX: // plain text
				var header=this.plainTextHeader.format(headerargs);
				var footer=this.plainTextFooter;
				break;
			case this.type_CS: // comma-separated
				var fields={};
				for (var i=0; i&lt;tids.length; i++) for (var f in tids[i].fields) fields[f]=f;
				var names=['title','created','modified','modifier','tags','text'];
				for (var f in fields) names.push(f);
				var header=names.join(',')+'\n';
				var footer='';
				break;
			case this.type_NF: // news feed (XML)
				headerargs[0]=store.getTiddlerText('SiteUrl','');
				var header=this.newsFeedHeader.format(headerargs);
				var footer=this.newsFeedFooter;
				break;
			case this.type_PS: // PureStore (no code)
				var header=this.pureStoreHeader.format(headerargs);
				var footer=this.pureStoreFooter;
				break;
			case this.type_TW: // full TiddlyWiki
			default:
				var currPath=getLocalPath(window.location.href);
				var original=loadFile(currPath);
				if (!original) { displayMessage(config.messages.cantSaveError); return; }
				var posDiv = locateStoreArea(original);
				if (!posDiv) { displayMessage(config.messages.invalidFileError.format([currPath])); return; }
				var header = original.substr(0,posDiv[0]+startSaveArea.length)+'\n';
				var footer = '\n'+original.substr(posDiv[1]);
				break;
		}
		var out=this.getData(target,filetype,tids,fields,merge);
		var revised = header+convertUnicodeToUTF8(out.join('\n'))+footer;
		// if full TW, insert page title and language attr, and reset all MARKUP blocks...
		if (filetype==this.type_TW) {
			var newSiteTitle=convertUnicodeToUTF8(getPageTitle()).htmlEncode();
			revised=revised.replaceChunk('&lt;title'+'&gt;','&lt;/title'+'&gt;',' ' + newSiteTitle + ' ');
			revised=updateLanguageAttribute(revised);
			var titles=[]; for (var i=0; i&lt;tids.length; i++) titles.push(tids[i].title);
			revised=updateMarkupBlock(revised,'PRE-HEAD',
				titles.contains('MarkupPreHead')? 'MarkupPreHead' :null);
			revised=updateMarkupBlock(revised,'POST-HEAD',
				titles.contains('MarkupPostHead')?'MarkupPostHead':null);
			revised=updateMarkupBlock(revised,'PRE-BODY',
				titles.contains('MarkupPreBody')? 'MarkupPreBody' :null);
			revised=updateMarkupBlock(revised,'POST-SCRIPT',
				titles.contains('MarkupPostBody')?'MarkupPostBody':null);
		}
		total.val=out.length;
		return revised;
	},
	getData: function(target,filetype,tids,fields,merge) {
		// output selected tiddlers and gather list of titles (for use with merge)
		var out=[]; var titles=[];
		var url=store.getTiddlerText('SiteUrl','');
		for (var i=0; i&lt;tids.length; i++) {
			out.push(this.formatItem(store,filetype,tids[i],url,fields));
			titles.push(tids[i].title);
		}
		// if TW or PureStore format, ask to merge with existing tiddlers (if any)
		if (filetype==this.type_TW || filetype==this.type_PS) {
			var txt=loadFile(target);
			if (txt &amp;&amp; txt.length) {
				var remoteStore=new TiddlyWiki();
				if (version.major+version.minor*.1+version.revision*.01&lt;2.52) txt=convertUTF8ToUnicode(txt);
				if (remoteStore.importTiddlyWiki(txt)) {
					var existing=remoteStore.getTiddlers('title');
					var msg=this.overwriteprompt.format([target,existing.length,existing.length!=1?'s':'']);
					if (merge) {
						var added=titles.length; var updated=0; var kept=0;
						for (var i=0; i&lt;existing.length; i++)
							if (titles.contains(existing[i].title)) {
								added--; updated++;
							} else {
								out.push(this.formatItem(remoteStore,filetype,existing[i],url));
								kept++;
							}
						displayMessage(this.mergestatus.format(
							[added,added!=1?'s':'',updated,updated!=1?'s':'',kept,kept!=1?'s':'',]));
					}
					else if (!confirm(msg)) out=[]; // empty the list = don't write file
				}
			}
		}
		return out;
	},
	formatItem: function(s,f,t,u,fields) {
		if (f==this.type_TW)
			var r=s.getSaver().externalizeTiddler(s,t);
		if (f==this.type_PS)
			var r=this.pureStoreTiddler.format([t.title,s.getSaver().externalizeTiddler(s,t)]);
		if (f==this.type_NF)
			var r=this.newsFeedTiddler.format([t.saveToRss(u)]);
		if (f==this.type_TX)
			var r=this.plainTextTiddler.format([t.title, t.created.toLocaleString(), t.modified.toLocaleString(),
				t.modifier, String.encodeTiddlyLinkList(t.tags), t.text]);
		if (f==this.type_CS) {
			function toCSV(t) { return '&quot;'+t.replace(/&quot;/g,'&quot;&quot;')+'&quot;'; } // always encode CSV
			var out=[ toCSV(t.title), toCSV(t.created.toLocaleString()), toCSV(t.modified.toLocaleString()),
				toCSV(t.modifier), toCSV(String.encodeTiddlyLinkList(t.tags)), toCSV(t.text) ];
			for (var f in fields) out.push(toCSV(t.fields[f]||''));
			var r=out.join(',');
		}
		return r||&quot;&quot;;
	}
}
//}}}
/***
!!!Control panel CSS
//{{{
!css
#exportPanel {
	display: none; position:absolute; z-index:12; width:35em; right:105%; top:6em;
	background-color: #eee; color:#000; font-size: 8pt; line-height:110%;
	border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;
	padding: 0.5em; margin:0em; -moz-border-radius:1em;-webkit-border-radius:1em;
}
#exportPanel a, #exportPanel td a { color:#009; display:inline; margin:0px; padding:1px; }
#exportPanel table {
	width:100%; border:0px; padding:0px; margin:0px;
	font-size:8pt; line-height:110%; background:transparent;
}
#exportPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }
#exportPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }
#exportPanel select { width:98%;margin:0px;font-size:8pt;line-height:110%;}
#exportPanel input  { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%; }
#exportPanel textarea  { width:98%;padding:0px;margin:0px;overflow:auto;font-size:8pt; }
#exportPanel .box {
	border:1px solid black; padding:3px; margin-bottom:5px;
	background:#f8f8f8; -moz-border-radius:5px;-webkit-border-radius:5px; }
#exportPanel .topline { border-top:2px solid black; padding-top:3px; margin-bottom:5px; }
#exportPanel .rad { width:auto;border:0 }
#exportPanel .chk { width:auto;border:0 }
#exportPanel .btn { width:auto; }
#exportPanel .btn1 { width:98%; }
#exportPanel .btn2 { width:48%; }
#exportPanel .btn3 { width:32%; }
#exportPanel .btn4 { width:24%; }
#exportPanel .btn5 { width:19%; }
!end
//}}}
!!!Control panel HTML
//{{{
!html
&lt;!-- target path/file  --&gt;
&lt;div&gt;
&lt;div style=&quot;float:right;padding-right:.5em&quot;&gt;
&lt;input type=&quot;checkbox&quot; style=&quot;width:auto&quot; id=&quot;exportMerge&quot; CHECKED
	title=&quot;combine selected tiddlers with existing tiddlers (if any) in export file&quot;&gt; merge
&lt;/div&gt;
export to:&lt;br&gt;
&lt;input type=&quot;text&quot; id=&quot;exportFilename&quot; size=40 style=&quot;width:93%&quot;&gt;&lt;input 
	type=&quot;button&quot; id=&quot;exportBrowse&quot; value=&quot;...&quot; title=&quot;select or enter a local folder/file...&quot; style=&quot;width:5%&quot; 
	onclick=&quot;var fn=config.macros.exportTiddlers.askForFilename(this); if (fn.length) this.previousSibling.value=fn; &quot;&gt;
&lt;/div&gt;

&lt;!-- output format --&gt;
&lt;div&gt;
format:
&lt;select id=&quot;exportFormat&quot; size=1&gt;
	&lt;option value=&quot;TW&quot;&gt;TiddlyWiki HTML document (includes core code)&lt;/option&gt;
	&lt;option value=&quot;PS&quot;&gt;TiddlyWiki &quot;PureStore&quot; HTML file (tiddler data only)&lt;/option&gt;
	&lt;option value=&quot;TX&quot;&gt;TiddlyWiki plain text TXT file (tiddler source listing)&lt;/option&gt;
	&lt;option value=&quot;CS&quot;&gt;Comma-Separated Value (CSV) data file&lt;/option&gt;
	&lt;option value=&quot;NF&quot;&gt;RSS NewsFeed XML file&lt;/option&gt;
&lt;/select&gt;
&lt;/div&gt;

&lt;!-- notes --&gt;
&lt;div&gt;
notes:&lt;br&gt;
&lt;textarea id=&quot;exportNotes&quot; rows=3 cols=40 style=&quot;height:4em;margin-bottom:5px;&quot; onfocus=&quot;this.select()&quot;&gt;&lt;/textarea&gt; 
&lt;/div&gt;

&lt;!-- list of tiddlers --&gt;
&lt;table&gt;&lt;tr align=&quot;left&quot;&gt;&lt;td&gt;
	select:
	&lt;a href=&quot;JavaScript:;&quot; id=&quot;exportSelectAll&quot;
		onclick=&quot;return config.macros.exportTiddlers.process(this)&quot; title=&quot;select all tiddlers&quot;&gt;
		&amp;nbsp;all&amp;nbsp;&lt;/a&gt;
	&lt;a href=&quot;JavaScript:;&quot; id=&quot;exportSelectChanges&quot;
		onclick=&quot;return config.macros.exportTiddlers.process(this)&quot; title=&quot;select tiddlers changed since last save&quot;&gt;
		&amp;nbsp;changes&amp;nbsp;&lt;/a&gt;
	&lt;a href=&quot;JavaScript:;&quot; id=&quot;exportSelectOpened&quot;
		onclick=&quot;return config.macros.exportTiddlers.process(this)&quot; title=&quot;select tiddlers currently being displayed&quot;&gt;
		&amp;nbsp;opened&amp;nbsp;&lt;/a&gt;
	&lt;a href=&quot;JavaScript:;&quot; id=&quot;exportSelectRelated&quot;
		onclick=&quot;return config.macros.exportTiddlers.process(this)&quot; title=&quot;select tiddlers related to the currently selected tiddlers&quot;&gt;
		&amp;nbsp;related&amp;nbsp;&lt;/a&gt;
	&lt;a href=&quot;JavaScript:;&quot; id=&quot;exportToggleFilter&quot;
		onclick=&quot;return config.macros.exportTiddlers.process(this)&quot; title=&quot;show/hide selection filter&quot;&gt;
		&amp;nbsp;filter&amp;nbsp;&lt;/a&gt;
&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;
	&lt;a href=&quot;JavaScript:;&quot; id=&quot;exportListSmaller&quot;
		onclick=&quot;return config.macros.exportTiddlers.process(this)&quot; title=&quot;reduce list size&quot;&gt;
		&amp;nbsp;&amp;#150;&amp;nbsp;&lt;/a&gt;
	&lt;a href=&quot;JavaScript:;&quot; id=&quot;exportListLarger&quot;
		onclick=&quot;return config.macros.exportTiddlers.process(this)&quot; title=&quot;increase list size&quot;&gt;
		&amp;nbsp;+&amp;nbsp;&lt;/a&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;select id=&quot;exportList&quot; multiple size=&quot;10&quot; style=&quot;margin-bottom:5px;&quot;
	onchange=&quot;config.macros.exportTiddlers.refreshList(this.selectedIndex)&quot;&gt;
&lt;/select&gt;&lt;br&gt;

&lt;!-- selection filter --&gt;
&lt;div id=&quot;exportFilterPanel&quot; style=&quot;display:none&quot;&gt;
&lt;table&gt;&lt;tr align=&quot;left&quot;&gt;&lt;td&gt;
	selection filter
&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;
	&lt;a href=&quot;JavaScript:;&quot; id=&quot;exportHideFilter&quot;
		onclick=&quot;return config.macros.exportTiddlers.process(this)&quot; title=&quot;hide selection filter&quot;&gt;hide&lt;/a&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;div class=&quot;box&quot;&gt;

&lt;input type=&quot;checkbox&quot; class=&quot;chk&quot; id=&quot;exportFilterStart&quot; value=&quot;1&quot;
	onclick=&quot;config.macros.exportTiddlers.showFilterFields(this)&quot;&gt; starting date/time&lt;br&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tr valign=&quot;center&quot;&gt;&lt;td width=&quot;50%&quot;&gt;
	&lt;select size=1 id=&quot;exportFilterStartBy&quot;
		onchange=&quot;config.macros.exportTiddlers.showFilterFields(this);&quot;&gt;
		&lt;option value=&quot;0&quot;&gt;today&lt;/option&gt;
		&lt;option value=&quot;1&quot;&gt;yesterday&lt;/option&gt;
		&lt;option value=&quot;7&quot;&gt;a week ago&lt;/option&gt;
		&lt;option value=&quot;30&quot;&gt;a month ago&lt;/option&gt;
		&lt;option value=&quot;file&quot;&gt;file date&lt;/option&gt;
		&lt;option value=&quot;other&quot;&gt;other (mm/dd/yyyy hh:mm)&lt;/option&gt;
	&lt;/select&gt;
&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;
	&lt;input type=&quot;text&quot; id=&quot;exportStartDate&quot; onfocus=&quot;this.select()&quot;
		onchange=&quot;config.macros.exportTiddlers.$('exportFilterStartBy').value='other';&quot;&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;input type=&quot;checkbox&quot; class=&quot;chk&quot; id=&quot;exportFilterEnd&quot; value=&quot;1&quot;
	onclick=&quot;config.macros.exportTiddlers.showFilterFields(this)&quot;&gt; ending date/time&lt;br&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tr valign=&quot;center&quot;&gt;&lt;td width=&quot;50%&quot;&gt;
	&lt;select size=1 id=&quot;exportFilterEndBy&quot;
		onchange=&quot;config.macros.exportTiddlers.showFilterFields(this);&quot;&gt;
		&lt;option value=&quot;0&quot;&gt;today&lt;/option&gt;
		&lt;option value=&quot;1&quot;&gt;yesterday&lt;/option&gt;
		&lt;option value=&quot;7&quot;&gt;a week ago&lt;/option&gt;
		&lt;option value=&quot;30&quot;&gt;a month ago&lt;/option&gt;
		&lt;option value=&quot;file&quot;&gt;file date&lt;/option&gt;
		&lt;option value=&quot;other&quot;&gt;other (mm/dd/yyyy hh:mm)&lt;/option&gt;
	&lt;/select&gt;
&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;
	&lt;input type=&quot;text&quot; id=&quot;exportEndDate&quot; onfocus=&quot;this.select()&quot;
		onchange=&quot;config.macros.exportTiddlers.$('exportFilterEndBy').value='other';&quot;&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;input type=&quot;checkbox&quot; class=&quot;chk&quot; id=exportFilterTags value=&quot;1&quot;
	onclick=&quot;config.macros.exportTiddlers.showFilterFields(this)&quot;&gt; match tags&lt;br&gt;
&lt;input type=&quot;text&quot; id=&quot;exportTags&quot; onfocus=&quot;this.select()&quot;&gt;

&lt;input type=&quot;checkbox&quot; class=&quot;chk&quot; id=exportFilterText value=&quot;1&quot;
	onclick=&quot;config.macros.exportTiddlers.showFilterFields(this)&quot;&gt; match titles/tiddler text&lt;br&gt;
&lt;input type=&quot;text&quot; id=&quot;exportText&quot; onfocus=&quot;this.select()&quot;&gt;

&lt;/div&gt; &lt;!--box--&gt;
&lt;/div&gt; &lt;!--panel--&gt;

&lt;!-- action buttons --&gt;
&lt;div style=&quot;text-align:center&quot;&gt;
&lt;input type=button class=&quot;btn4&quot; onclick=&quot;config.macros.exportTiddlers.process(this)&quot;
	id=&quot;exportFilter&quot; value=&quot;apply filter&quot;&gt;
&lt;input type=button class=&quot;btn4&quot; onclick=&quot;config.macros.exportTiddlers.process(this)&quot;
	id=&quot;exportStart&quot; value=&quot;export tiddlers&quot;&gt;
&lt;input type=button class=&quot;btn4&quot; onclick=&quot;config.macros.exportTiddlers.process(this)&quot;
	id=&quot;exportDelete&quot; value=&quot;delete tiddlers&quot;&gt;
&lt;input type=button class=&quot;btn4&quot; onclick=&quot;config.macros.exportTiddlers.process(this)&quot;
	id=&quot;exportClose&quot; value=&quot;close&quot;&gt;
&lt;/div&gt;&lt;!--center--&gt;
!end
//}}}
***/</pre>
</div>
<div title="FontSizePlugin" modifier="dger" created="201007171522" modified="201009301849" tags="systemConfig lewcidExtension plugin pluginInfo %tw-elnb">
<pre>/***
|Name|FontSizePlugin|
|Created by|SaqImtiaz|
|Location|http://tw.lewcid.org/#FontSizePlugin|
|Version|1.0|
|Requires|~TW2.x|
!Description:
Resize tiddler text on the fly. The text size is remembered between sessions by use of a cookie.
You can customize the maximum and minimum allowed sizes.
(only affects tiddler content text, not any other text)

Also, you can load a TW file with a font-size specified in the url.
Eg: http://tw.lewcid.org/#font:110

!Demo:
Try using the font-size buttons in the sidebar, or in the MainMenu above.

!Installation:
Copy the contents of this tiddler to your TW, tag with systemConfig, save and reload your TW.
Then put {{{&lt;&lt;fontSize &quot;font-size:&quot;&gt;&gt;}}} in your SideBarOptions tiddler, or anywhere else that you might like.

!Usage
{{{&lt;&lt;fontSize&gt;&gt;}}} results in &lt;&lt;fontSize&gt;&gt;
{{{&lt;&lt;fontSize font-size: &gt;&gt;}}} results in &lt;&lt;fontSize font-size:&gt;&gt;

!Customizing:
The buttons and prefix text are wrapped in a span with class fontResizer, for easy css styling.
To change the default font-size, and the maximum and minimum font-size allowed, edit the config.fontSize.settings section of the code below.

!Notes:
This plugin assumes that the initial font-size is 100% and then increases or decreases the size by 10%. This stepsize of 10% can also be customized.

!History:
*27-07-06, version 1.0 : prevented double clicks from triggering editing of containing tiddler.
*25-07-06,  version 0.9

!Code
***/

//{{{
config.fontSize={};

//configuration settings
config.fontSize.settings =
{
            defaultSize : 100,  // all sizes in %
            maxSize : 200,
            minSize : 40,
            stepSize : 10
};

//startup code
var fontSettings = config.fontSize.settings;

if (!config.options.txtFontSize)
            {config.options.txtFontSize = fontSettings.defaultSize;
            saveOptionCookie(&quot;txtFontSize&quot;);}
setStylesheet(&quot;.tiddler .viewer {font-size:&quot;+config.options.txtFontSize+&quot;%;}\n&quot;,&quot;fontResizerStyles&quot;);
setStylesheet(&quot;#contentWrapper .fontResizer .button {display:inline;font-size:105%; font-weight:bold; margin:0 1px; padding: 0 3px; text-align:center !important;}\n .fontResizer {margin:0 0.5em;}&quot;,&quot;fontResizerButtonStyles&quot;);

//macro
config.macros.fontSize={};
config.macros.fontSize.handler = function (place,macroName,params,wikifier,paramString,tiddler)
{

               var sp = createTiddlyElement(place,&quot;span&quot;,null,&quot;fontResizer&quot;);
               sp.ondblclick=this.onDblClick;
               if (params[0])
                           createTiddlyText(sp,params[0]);
               createTiddlyButton(sp,&quot;+&quot;,&quot;increase font-size&quot;,this.incFont);
               createTiddlyButton(sp,&quot;=&quot;,&quot;reset font-size&quot;,this.resetFont);
               createTiddlyButton(sp,&quot;–&quot;,&quot;decrease font-size&quot;,this.decFont);
}

config.macros.fontSize.onDblClick = function (e)
{
             if (!e) var e = window.event;
             e.cancelBubble = true;
             if (e.stopPropagation) e.stopPropagation();
             return false;
}

config.macros.fontSize.setFont = function ()
{
               saveOptionCookie(&quot;txtFontSize&quot;);
               setStylesheet(&quot;.tiddler .viewer {font-size:&quot;+config.options.txtFontSize+&quot;%;}\n&quot;,&quot;fontResizerStyles&quot;);
}

config.macros.fontSize.incFont=function()
{
               if (config.options.txtFontSize &lt; fontSettings.maxSize)
                  config.options.txtFontSize = (config.options.txtFontSize*1)+fontSettings.stepSize;
               config.macros.fontSize.setFont();
}

config.macros.fontSize.decFont=function()
{

               if (config.options.txtFontSize &gt; fontSettings.minSize)
                  config.options.txtFontSize = (config.options.txtFontSize*1) - fontSettings.stepSize;
               config.macros.fontSize.setFont();
}

config.macros.fontSize.resetFont=function()
{

               config.options.txtFontSize=fontSettings.defaultSize;
               config.macros.fontSize.setFont();
}

config.paramifiers.font =
{
               onstart: function(v)
                  {
                   config.options.txtFontSize = v;
                   config.macros.fontSize.setFont();
                  }
};
//}}}</pre>
</div>
<div title="ForEachTiddlerPlugin" modifier="dger" created="201007171401" modified="201009301854" tags="ForEachTiddlerPackage plugin systemConfig %tw-elnb">
<pre>/***
|''Name:''|ForEachTiddlerPlugin|
|''Version:''|1.0.8 (2007-04-12)|
|''Source:''|http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]|
|''Copyright:''|&amp;copy; 2005-2007 [[abego Software|http://www.abego-software.de]]|
|''TiddlyWiki:''|1.2.38+, 2.0|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|
!Description

Create customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.

''Syntax:'' 
|&gt;|{{{&lt;&lt;}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{&gt;&gt;}}}|
|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|
|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and  {{{context}}}.|
|//sortExpression//|(quoted) JavaScript expression returning &quot;comparable&quot; objects (using '{{{&lt;}}}','{{{&gt;}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and  {{{context}}}.|
|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|
|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]]  is used.|
|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). &lt;&lt;tiddler [[JavaScript in actionParameters]]&gt;&gt;|
|&gt;|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|

See details see [[ForEachTiddlerMacro]] and [[ForEachTiddlerExamples]].

!Revision history
* v1.0.8 (2007-04-12)
** Adapted to latest TiddlyWiki 2.2 Beta importTiddlyWiki API (introduced with changeset 2004). TiddlyWiki 2.2 Beta builds prior to changeset 2004 are no longer supported (but TiddlyWiki 2.1 and earlier, of cause)
* v1.0.7 (2007-03-28)
** Also support &quot;pre&quot; formatted TiddlyWikis (introduced with TW 2.2) (when using &quot;in&quot; clause to work on external tiddlers)
* v1.0.6 (2006-09-16)
** Context provides &quot;viewerTiddler&quot;, i.e. the tiddler used to view the macro. Most times this is equal to the &quot;inTiddler&quot;, but when using the &quot;tiddler&quot; macro both may be different.
** Support &quot;begin&quot;, &quot;end&quot; and &quot;none&quot; expressions in &quot;write&quot; action
* v1.0.5 (2006-02-05)
** Pass tiddler containing the macro with wikify, context object also holds reference to tiddler containing the macro (&quot;inTiddler&quot;). Thanks to SimonBaird.
** Support Firefox 1.5.0.1
** Internal
*** Make &quot;JSLint&quot; conform
*** &quot;Only install once&quot;
* v1.0.4 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.3 (2005-12-22)
** Features: 
*** Write output to a file supports multi-byte environments (Thanks to Bram Chen) 
*** Provide API to access the forEachTiddler functionality directly through JavaScript (see getTiddlers and performMacro)
** Enhancements:
*** Improved error messages on InternetExplorer.
* v1.0.2 (2005-12-10)
** Features: 
*** context object also holds reference to store (TiddlyWiki)
** Fixed Bugs: 
*** ForEachTiddler 1.0.1 has broken support on win32 Opera 8.51 (Thanks to BrunoSabin for reporting)
* v1.0.1 (2005-12-08)
** Features: 
*** Access tiddlers stored in separated TiddlyWikis through the &quot;in&quot; option. I.e. you are no longer limited to only work on the &quot;current TiddlyWiki&quot;.
*** Write output to an external file using the &quot;toFile&quot; option of the &quot;write&quot; action. With this option you may write your customized tiddler exports.
*** Use the &quot;script&quot; section to define &quot;helper&quot; JavaScript functions etc. to be used in the various JavaScript expressions (whereClause, sortClause, action arguments,...).
*** Access and store context information for the current forEachTiddler invocation (through the build-in &quot;context&quot; object) .
*** Improved script evaluation (for where/sort clause and write scripts).
* v1.0.0 (2005-11-20)
** initial version

!Code
***/
//{{{

	
//============================================================================
//============================================================================
//		   ForEachTiddlerPlugin
//============================================================================
//============================================================================

// Only install once
if (!version.extensions.ForEachTiddlerPlugin) {

if (!window.abego) window.abego = {};

version.extensions.ForEachTiddlerPlugin = {
	major: 1, minor: 0, revision: 8, 
	date: new Date(2007,3,12), 
	source: &quot;http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin&quot;,
	licence: &quot;[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]&quot;,
	copyright: &quot;Copyright (c) abego Software GmbH, 2005-2007 (www.abego-software.de)&quot;
};

// For backward compatibility with TW 1.2.x
//
if (!TiddlyWiki.prototype.forEachTiddler) {
	TiddlyWiki.prototype.forEachTiddler = function(callback) {
		for(var t in this.tiddlers) {
			callback.call(this,t,this.tiddlers[t]);
		}
	};
}

//============================================================================
// forEachTiddler Macro
//============================================================================

version.extensions.forEachTiddler = {
	major: 1, minor: 0, revision: 8, date: new Date(2007,3,12), provider: &quot;http://tiddlywiki.abego-software.de&quot;};

// ---------------------------------------------------------------------------
// Configurations and constants 
// ---------------------------------------------------------------------------

config.macros.forEachTiddler = {
	 // Standard Properties
	 label: &quot;forEachTiddler&quot;,
	 prompt: &quot;Perform actions on a (sorted) selection of tiddlers&quot;,

	 // actions
	 actions: {
		 addToList: {},
		 write: {}
	 }
};

// ---------------------------------------------------------------------------
//  The forEachTiddler Macro Handler 
// ---------------------------------------------------------------------------

config.macros.forEachTiddler.getContainingTiddler = function(e) {
	while(e &amp;&amp; !hasClass(e,&quot;tiddler&quot;))
		e = e.parentNode;
	var title = e ? e.getAttribute(&quot;tiddler&quot;) : null; 
	return title ? store.getTiddler(title) : null;
};

config.macros.forEachTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
	// config.macros.forEachTiddler.traceMacroCall(place,macroName,params,wikifier,paramString,tiddler);

	if (!tiddler) tiddler = config.macros.forEachTiddler.getContainingTiddler(place);
	// --- Parsing ------------------------------------------

	var i = 0; // index running over the params
	// Parse the &quot;in&quot; clause
	var tiddlyWikiPath = undefined;
	if ((i &lt; params.length) &amp;&amp; params[i] == &quot;in&quot;) {
		i++;
		if (i &gt;= params.length) {
			this.handleError(place, &quot;TiddlyWiki path expected behind 'in'.&quot;);
			return;
		}
		tiddlyWikiPath = this.paramEncode((i &lt; params.length) ? params[i] : &quot;&quot;);
		i++;
	}

	// Parse the where clause
	var whereClause =&quot;true&quot;;
	if ((i &lt; params.length) &amp;&amp; params[i] == &quot;where&quot;) {
		i++;
		whereClause = this.paramEncode((i &lt; params.length) ? params[i] : &quot;&quot;);
		i++;
	}

	// Parse the sort stuff
	var sortClause = null;
	var sortAscending = true; 
	if ((i &lt; params.length) &amp;&amp; params[i] == &quot;sortBy&quot;) {
		i++;
		if (i &gt;= params.length) {
			this.handleError(place, &quot;sortClause missing behind 'sortBy'.&quot;);
			return;
		}
		sortClause = this.paramEncode(params[i]);
		i++;

		if ((i &lt; params.length) &amp;&amp; (params[i] == &quot;ascending&quot; || params[i] == &quot;descending&quot;)) {
			 sortAscending = params[i] == &quot;ascending&quot;;
			 i++;
		}
	}

	// Parse the script
	var scriptText = null;
	if ((i &lt; params.length) &amp;&amp; params[i] == &quot;script&quot;) {
		i++;
		scriptText = this.paramEncode((i &lt; params.length) ? params[i] : &quot;&quot;);
		i++;
	}

	// Parse the action. 
	// When we are already at the end use the default action
	var actionName = &quot;addToList&quot;;
	if (i &lt; params.length) {
	   if (!config.macros.forEachTiddler.actions[params[i]]) {
			this.handleError(place, &quot;Unknown action '&quot;+params[i]+&quot;'.&quot;);
			return;
		} else {
			actionName = params[i]; 
			i++;
		}
	} 
	
	// Get the action parameter
	// (the parsing is done inside the individual action implementation.)
	var actionParameter = params.slice(i);


	// --- Processing ------------------------------------------
	try {
		this.performMacro({
				place: place, 
				inTiddler: tiddler,
				whereClause: whereClause, 
				sortClause: sortClause, 
				sortAscending: sortAscending, 
				actionName: actionName, 
				actionParameter: actionParameter, 
				scriptText: scriptText, 
				tiddlyWikiPath: tiddlyWikiPath});

	} catch (e) {
		this.handleError(place, e);
	}
};

// Returns an object with properties &quot;tiddlers&quot; and &quot;context&quot;.
// tiddlers holds the (sorted) tiddlers selected by the parameter,
// context the context of the execution of the macro.
//
// The action is not yet performed.
//
// @parameter see performMacro
//
config.macros.forEachTiddler.getTiddlersAndContext = function(parameter) {

	var context = config.macros.forEachTiddler.createContext(parameter.place, parameter.whereClause, parameter.sortClause, parameter.sortAscending, parameter.actionName, parameter.actionParameter, parameter.scriptText, parameter.tiddlyWikiPath, parameter.inTiddler);

	var tiddlyWiki = parameter.tiddlyWikiPath ? this.loadTiddlyWiki(parameter.tiddlyWikiPath) : store;
	context[&quot;tiddlyWiki&quot;] = tiddlyWiki;
	
	// Get the tiddlers, as defined by the whereClause
	var tiddlers = this.findTiddlers(parameter.whereClause, context, tiddlyWiki);
	context[&quot;tiddlers&quot;] = tiddlers;

	// Sort the tiddlers, when sorting is required.
	if (parameter.sortClause) {
		this.sortTiddlers(tiddlers, parameter.sortClause, parameter.sortAscending, context);
	}

	return {tiddlers: tiddlers, context: context};
};

// Returns the (sorted) tiddlers selected by the parameter.
//
// The action is not yet performed.
//
// @parameter see performMacro
//
config.macros.forEachTiddler.getTiddlers = function(parameter) {
	return this.getTiddlersAndContext(parameter).tiddlers;
};

// Performs the macros with the given parameter.
//
// @param parameter holds the parameter of the macro as separate properties.
//				  The following properties are supported:
//
//						place
//						whereClause
//						sortClause
//						sortAscending
//						actionName
//						actionParameter
//						scriptText
//						tiddlyWikiPath
//
//					All properties are optional. 
//					For most actions the place property must be defined.
//
config.macros.forEachTiddler.performMacro = function(parameter) {
	var tiddlersAndContext = this.getTiddlersAndContext(parameter);

	// Perform the action
	var actionName = parameter.actionName ? parameter.actionName : &quot;addToList&quot;;
	var action = config.macros.forEachTiddler.actions[actionName];
	if (!action) {
		this.handleError(parameter.place, &quot;Unknown action '&quot;+actionName+&quot;'.&quot;);
		return;
	}

	var actionHandler = action.handler;
	actionHandler(parameter.place, tiddlersAndContext.tiddlers, parameter.actionParameter, tiddlersAndContext.context);
};

// ---------------------------------------------------------------------------
//  The actions 
// ---------------------------------------------------------------------------

// Internal.
//
// --- The addToList Action -----------------------------------------------
//
config.macros.forEachTiddler.actions.addToList.handler = function(place, tiddlers, parameter, context) {
	// Parse the parameter
	var p = 0;

	// Check for extra parameters
	if (parameter.length &gt; p) {
		config.macros.forEachTiddler.createExtraParameterErrorElement(place, &quot;addToList&quot;, parameter, p);
		return;
	}

	// Perform the action.
	var list = document.createElement(&quot;ul&quot;);
	place.appendChild(list);
	for (var i = 0; i &lt; tiddlers.length; i++) {
		var tiddler = tiddlers[i];
		var listItem = document.createElement(&quot;li&quot;);
		list.appendChild(listItem);
		createTiddlyLink(listItem, tiddler.title, true);
	}
};

abego.parseNamedParameter = function(name, parameter, i) {
	var beginExpression = null;
	if ((i &lt; parameter.length) &amp;&amp; parameter[i] == name) {
		i++;
		if (i &gt;= parameter.length) {
			throw &quot;Missing text behind '%0'&quot;.format([name]);
		}
		
		return config.macros.forEachTiddler.paramEncode(parameter[i]);
	}
	return null;
}

// Internal.
//
// --- The write Action ---------------------------------------------------
//
config.macros.forEachTiddler.actions.write.handler = function(place, tiddlers, parameter, context) {
	// Parse the parameter
	var p = 0;
	if (p &gt;= parameter.length) {
		this.handleError(place, &quot;Missing expression behind 'write'.&quot;);
		return;
	}

	var textExpression = config.macros.forEachTiddler.paramEncode(parameter[p]);
	p++;

	// Parse the &quot;begin&quot; option
	var beginExpression = abego.parseNamedParameter(&quot;begin&quot;, parameter, p);
	if (beginExpression !== null) 
		p += 2;
	var endExpression = abego.parseNamedParameter(&quot;end&quot;, parameter, p);
	if (endExpression !== null) 
		p += 2;
	var noneExpression = abego.parseNamedParameter(&quot;none&quot;, parameter, p);
	if (noneExpression !== null) 
		p += 2;

	// Parse the &quot;toFile&quot; option
	var filename = null;
	var lineSeparator = undefined;
	if ((p &lt; parameter.length) &amp;&amp; parameter[p] == &quot;toFile&quot;) {
		p++;
		if (p &gt;= parameter.length) {
			this.handleError(place, &quot;Filename expected behind 'toFile' of 'write' action.&quot;);
			return;
		}
		
		filename = config.macros.forEachTiddler.getLocalPath(config.macros.forEachTiddler.paramEncode(parameter[p]));
		p++;
		if ((p &lt; parameter.length) &amp;&amp; parameter[p] == &quot;withLineSeparator&quot;) {
			p++;
			if (p &gt;= parameter.length) {
				this.handleError(place, &quot;Line separator text expected behind 'withLineSeparator' of 'write' action.&quot;);
				return;
			}
			lineSeparator = config.macros.forEachTiddler.paramEncode(parameter[p]);
			p++;
		}
	}
	
	// Check for extra parameters
	if (parameter.length &gt; p) {
		config.macros.forEachTiddler.createExtraParameterErrorElement(place, &quot;write&quot;, parameter, p);
		return;
	}

	// Perform the action.
	var func = config.macros.forEachTiddler.getEvalTiddlerFunction(textExpression, context);
	var count = tiddlers.length;
	var text = &quot;&quot;;
	if (count &gt; 0 &amp;&amp; beginExpression)
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(beginExpression, context)(undefined, context, count, undefined);
	
	for (var i = 0; i &lt; count; i++) {
		var tiddler = tiddlers[i];
		text += func(tiddler, context, count, i);
	}
	
	if (count &gt; 0 &amp;&amp; endExpression)
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(endExpression, context)(undefined, context, count, undefined);

	if (count == 0 &amp;&amp; noneExpression) 
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(noneExpression, context)(undefined, context, count, undefined);
		

	if (filename) {
		if (lineSeparator !== undefined) {
			lineSeparator = lineSeparator.replace(/\\n/mg, &quot;\n&quot;).replace(/\\r/mg, &quot;\r&quot;);
			text = text.replace(/\n/mg,lineSeparator);
		}
		saveFile(filename, convertUnicodeToUTF8(text));
	} else {
		var wrapper = createTiddlyElement(place, &quot;span&quot;);
		wikify(text, wrapper, null/* highlightRegExp */, context.inTiddler);
	}
};


// ---------------------------------------------------------------------------
//  Helpers
// ---------------------------------------------------------------------------

// Internal.
//
config.macros.forEachTiddler.createContext = function(placeParam, whereClauseParam, sortClauseParam, sortAscendingParam, actionNameParam, actionParameterParam, scriptText, tiddlyWikiPathParam, inTiddlerParam) {
	return {
		place : placeParam, 
		whereClause : whereClauseParam, 
		sortClause : sortClauseParam, 
		sortAscending : sortAscendingParam, 
		script : scriptText,
		actionName : actionNameParam, 
		actionParameter : actionParameterParam,
		tiddlyWikiPath : tiddlyWikiPathParam,
		inTiddler : inTiddlerParam, // the tiddler containing the &lt;&lt;forEachTiddler ...&gt;&gt; macro call.
		viewerTiddler : config.macros.forEachTiddler.getContainingTiddler(placeParam) // the tiddler showing the forEachTiddler result
	};
};

// Internal.
//
// Returns a TiddlyWiki with the tiddlers loaded from the TiddlyWiki of 
// the given path.
//
config.macros.forEachTiddler.loadTiddlyWiki = function(path, idPrefix) {
	if (!idPrefix) {
		idPrefix = &quot;store&quot;;
	}
	var lenPrefix = idPrefix.length;
	
	// Read the content of the given file
	var content = loadFile(this.getLocalPath(path));
	if(content === null) {
		throw &quot;TiddlyWiki '&quot;+path+&quot;' not found.&quot;;
	}
	
	var tiddlyWiki = new TiddlyWiki();

	// Starting with TW 2.2 there is a helper function to import the tiddlers
	if (tiddlyWiki.importTiddlyWiki) {
		if (!tiddlyWiki.importTiddlyWiki(content))
			throw &quot;File '&quot;+path+&quot;' is not a TiddlyWiki.&quot;;
		tiddlyWiki.dirty = false;
		return tiddlyWiki;
	}
	
	// The legacy code, for TW &lt; 2.2
	
	// Locate the storeArea div's
	var posOpeningDiv = content.indexOf(startSaveArea);
	var posClosingDiv = content.lastIndexOf(endSaveArea);
	if((posOpeningDiv == -1) || (posClosingDiv == -1)) {
		throw &quot;File '&quot;+path+&quot;' is not a TiddlyWiki.&quot;;
	}
	var storageText = content.substr(posOpeningDiv + startSaveArea.length, posClosingDiv);
	
	// Create a &quot;div&quot; element that contains the storage text
	var myStorageDiv = document.createElement(&quot;div&quot;);
	myStorageDiv.innerHTML = storageText;
	myStorageDiv.normalize();
	
	// Create all tiddlers in a new TiddlyWiki
	// (following code is modified copy of TiddlyWiki.prototype.loadFromDiv)
	var store = myStorageDiv.childNodes;
	for(var t = 0; t &lt; store.length; t++) {
		var e = store[t];
		var title = null;
		if(e.getAttribute)
			title = e.getAttribute(&quot;tiddler&quot;);
		if(!title &amp;&amp; e.id &amp;&amp; e.id.substr(0,lenPrefix) == idPrefix)
			title = e.id.substr(lenPrefix);
		if(title &amp;&amp; title !== &quot;&quot;) {
			var tiddler = tiddlyWiki.createTiddler(title);
			tiddler.loadFromDiv(e,title);
		}
	}
	tiddlyWiki.dirty = false;

	return tiddlyWiki;
};


	
// Internal.
//
// Returns a function that has a function body returning the given javaScriptExpression.
// The function has the parameters:
// 
//	 (tiddler, context, count, index)
//
config.macros.forEachTiddler.getEvalTiddlerFunction = function (javaScriptExpression, context) {
	var script = context[&quot;script&quot;];
	var functionText = &quot;var theFunction = function(tiddler, context, count, index) { return &quot;+javaScriptExpression+&quot;}&quot;;
	var fullText = (script ? script+&quot;;&quot; : &quot;&quot;)+functionText+&quot;;theFunction;&quot;;
	return eval(fullText);
};

// Internal.
//
config.macros.forEachTiddler.findTiddlers = function(whereClause, context, tiddlyWiki) {
	var result = [];
	var func = config.macros.forEachTiddler.getEvalTiddlerFunction(whereClause, context);
	tiddlyWiki.forEachTiddler(function(title,tiddler) {
		if (func(tiddler, context, undefined, undefined)) {
			result.push(tiddler);
		}
	});
	return result;
};

// Internal.
//
config.macros.forEachTiddler.createExtraParameterErrorElement = function(place, actionName, parameter, firstUnusedIndex) {
	var message = &quot;Extra parameter behind '&quot;+actionName+&quot;':&quot;;
	for (var i = firstUnusedIndex; i &lt; parameter.length; i++) {
		message += &quot; &quot;+parameter[i];
	}
	this.handleError(place, message);
};

// Internal.
//
config.macros.forEachTiddler.sortAscending = function(tiddlerA, tiddlerB) {
	var result = 
		(tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue) 
			? 0
			: (tiddlerA.forEachTiddlerSortValue &lt; tiddlerB.forEachTiddlerSortValue)
			   ? -1 
			   : +1; 
	return result;
};

// Internal.
//
config.macros.forEachTiddler.sortDescending = function(tiddlerA, tiddlerB) {
	var result = 
		(tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue) 
			? 0
			: (tiddlerA.forEachTiddlerSortValue &lt; tiddlerB.forEachTiddlerSortValue)
			   ? +1 
			   : -1; 
	return result;
};

// Internal.
//
config.macros.forEachTiddler.sortTiddlers = function(tiddlers, sortClause, ascending, context) {
	// To avoid evaluating the sortClause whenever two items are compared 
	// we pre-calculate the sortValue for every item in the array and store it in a 
	// temporary property (&quot;forEachTiddlerSortValue&quot;) of the tiddlers.
	var func = config.macros.forEachTiddler.getEvalTiddlerFunction(sortClause, context);
	var count = tiddlers.length;
	var i;
	for (i = 0; i &lt; count; i++) {
		var tiddler = tiddlers[i];
		tiddler.forEachTiddlerSortValue = func(tiddler,context, undefined, undefined);
	}

	// Do the sorting
	tiddlers.sort(ascending ? this.sortAscending : this.sortDescending);

	// Delete the temporary property that holds the sortValue.	
	for (i = 0; i &lt; tiddlers.length; i++) {
		delete tiddlers[i].forEachTiddlerSortValue;
	}
};


// Internal.
//
config.macros.forEachTiddler.trace = function(message) {
	displayMessage(message);
};

// Internal.
//
config.macros.forEachTiddler.traceMacroCall = function(place,macroName,params) {
	var message =&quot;&lt;&lt;&quot;+macroName;
	for (var i = 0; i &lt; params.length; i++) {
		message += &quot; &quot;+params[i];
	}
	message += &quot;&gt;&gt;&quot;;
	displayMessage(message);
};


// Internal.
//
// Creates an element that holds an error message
// 
config.macros.forEachTiddler.createErrorElement = function(place, exception) {
	var message = (exception.description) ? exception.description : exception.toString();
	return createTiddlyElement(place,&quot;span&quot;,null,&quot;forEachTiddlerError&quot;,&quot;&lt;&lt;forEachTiddler ...&gt;&gt;: &quot;+message);
};

// Internal.
//
// @param place [may be null]
//
config.macros.forEachTiddler.handleError = function(place, exception) {
	if (place) {
		this.createErrorElement(place, exception);
	} else {
		throw exception;
	}
};

// Internal.
//
// Encodes the given string.
//
// Replaces 
//	 &quot;$))&quot; to &quot;&gt;&gt;&quot;
//	 &quot;$)&quot; to &quot;&gt;&quot;
//
config.macros.forEachTiddler.paramEncode = function(s) {
	var reGTGT = new RegExp(&quot;\\$\\)\\)&quot;,&quot;mg&quot;);
	var reGT = new RegExp(&quot;\\$\\)&quot;,&quot;mg&quot;);
	return s.replace(reGTGT, &quot;&gt;&gt;&quot;).replace(reGT, &quot;&gt;&quot;);
};

// Internal.
//
// Returns the given original path (that is a file path, starting with &quot;file:&quot;)
// as a path to a local file, in the systems native file format.
//
// Location information in the originalPath (i.e. the &quot;#&quot; and stuff following)
// is stripped.
// 
config.macros.forEachTiddler.getLocalPath = function(originalPath) {
	// Remove any location part of the URL
	var hashPos = originalPath.indexOf(&quot;#&quot;);
	if(hashPos != -1)
		originalPath = originalPath.substr(0,hashPos);
	// Convert to a native file format assuming
	// &quot;file:///x:/path/path/path...&quot; - pc local file --&gt; &quot;x:\path\path\path...&quot;
	// &quot;file://///server/share/path/path/path...&quot; - FireFox pc network file --&gt; &quot;\\server\share\path\path\path...&quot;
	// &quot;file:///path/path/path...&quot; - mac/unix local file --&gt; &quot;/path/path/path...&quot;
	// &quot;file://server/share/path/path/path...&quot; - pc network file --&gt; &quot;\\server\share\path\path\path...&quot;
	var localPath;
	if(originalPath.charAt(9) == &quot;:&quot;) // pc local file
		localPath = unescape(originalPath.substr(8)).replace(new RegExp(&quot;/&quot;,&quot;g&quot;),&quot;\\&quot;);
	else if(originalPath.indexOf(&quot;file://///&quot;) === 0) // FireFox pc network file
		localPath = &quot;\\\\&quot; + unescape(originalPath.substr(10)).replace(new RegExp(&quot;/&quot;,&quot;g&quot;),&quot;\\&quot;);
	else if(originalPath.indexOf(&quot;file:///&quot;) === 0) // mac/unix local file
		localPath = unescape(originalPath.substr(7));
	else if(originalPath.indexOf(&quot;file:/&quot;) === 0) // mac/unix local file
		localPath = unescape(originalPath.substr(5));
	else // pc network file
		localPath = &quot;\\\\&quot; + unescape(originalPath.substr(7)).replace(new RegExp(&quot;/&quot;,&quot;g&quot;),&quot;\\&quot;);	
	return localPath;
};

// ---------------------------------------------------------------------------
// Stylesheet Extensions (may be overridden by local StyleSheet)
// ---------------------------------------------------------------------------
//
setStylesheet(
	&quot;.forEachTiddlerError{color: #ffffff;background-color: #880000;}&quot;,
	&quot;forEachTiddler&quot;);

//============================================================================
// End of forEachTiddler Macro
//============================================================================


//============================================================================
// String.startsWith Function
//============================================================================
//
// Returns true if the string starts with the given prefix, false otherwise.
//
version.extensions[&quot;String.startsWith&quot;] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: &quot;http://tiddlywiki.abego-software.de&quot;};
//
String.prototype.startsWith = function(prefix) {
	var n =  prefix.length;
	return (this.length &gt;= n) &amp;&amp; (this.slice(0, n) == prefix);
};



//============================================================================
// String.endsWith Function
//============================================================================
//
// Returns true if the string ends with the given suffix, false otherwise.
//
version.extensions[&quot;String.endsWith&quot;] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: &quot;http://tiddlywiki.abego-software.de&quot;};
//
String.prototype.endsWith = function(suffix) {
	var n = suffix.length;
	return (this.length &gt;= n) &amp;&amp; (this.right(n) == suffix);
};


//============================================================================
// String.contains Function
//============================================================================
//
// Returns true when the string contains the given substring, false otherwise.
//
version.extensions[&quot;String.contains&quot;] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: &quot;http://tiddlywiki.abego-software.de&quot;};
//
String.prototype.contains = function(substring) {
	return this.indexOf(substring) &gt;= 0;
};

//============================================================================
// Array.indexOf Function
//============================================================================
//
// Returns the index of the first occurance of the given item in the array or 
// -1 when no such item exists.
//
// @param item [may be null]
//
version.extensions[&quot;Array.indexOf&quot;] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: &quot;http://tiddlywiki.abego-software.de&quot;};
//
Array.prototype.indexOf = function(item) {
	for (var i = 0; i &lt; this.length; i++) {
		if (this[i] == item) {
			return i;
		}
	}
	return -1;
};

//============================================================================
// Array.contains Function
//============================================================================
//
// Returns true when the array contains the given item, otherwise false. 
//
// @param item [may be null]
//
version.extensions[&quot;Array.contains&quot;] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: &quot;http://tiddlywiki.abego-software.de&quot;};
//
Array.prototype.contains = function(item) {
	return (this.indexOf(item) &gt;= 0);
};

//============================================================================
// Array.containsAny Function
//============================================================================
//
// Returns true when the array contains at least one of the elements 
// of the item. Otherwise (or when items contains no elements) false is returned.
//
version.extensions[&quot;Array.containsAny&quot;] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: &quot;http://tiddlywiki.abego-software.de&quot;};
//
Array.prototype.containsAny = function(items) {
	for(var i = 0; i &lt; items.length; i++) {
		if (this.contains(items[i])) {
			return true;
		}
	}
	return false;
};


//============================================================================
// Array.containsAll Function
//============================================================================
//
// Returns true when the array contains all the items, otherwise false.
// 
// When items is null false is returned (even if the array contains a null).
//
// @param items [may be null] 
//
version.extensions[&quot;Array.containsAll&quot;] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: &quot;http://tiddlywiki.abego-software.de&quot;};
//
Array.prototype.containsAll = function(items) {
	for(var i = 0; i &lt; items.length; i++) {
		if (!this.contains(items[i])) {
			return false;
		}
	}
	return true;
};


} // of &quot;install only once&quot;

// Used Globals (for JSLint) ==============
// ... DOM
/*global 	document */
// ... TiddlyWiki Core
/*global 	convertUnicodeToUTF8, createTiddlyElement, createTiddlyLink, 
			displayMessage, endSaveArea, hasClass, loadFile, saveFile, 
			startSaveArea, store, wikify */
//}}}


/***
!Licence and Copyright
Copyright (c) abego Software ~GmbH, 2005 ([[www.abego-software.de|http://www.abego-software.de]])

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

Neither the name of abego Software nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
***/</pre>
</div>
<div title="FullScreen Plugin" modifier="escdie" created="201011201712" modified="201011201755" tags="systemConfig plugin %tw-elnb">
<pre>/***
|Name|FullScreenPlugin|
|Created by|SaqImtiaz|
|Location|http://tw.lewcid.org/#FullScreenPlugin|
|Version|1.1|
|Requires|~TW2.x|

''@@color:blue;font-size:125%;Hacked, it uses __refreshPageTemplate__ now@@''

!Description:
Toggle between viewing tiddlers fullscreen and normally. Very handy for when you need more viewing space.

!Demo:
Click the ↕ button in the toolbar for this tiddler. Click it again to turn off fullscreen.

!Installation:
Copy the contents of this tiddler to your TW, tag with systemConfig, save and reload your TW.
Edit the ViewTemplate to add the fullscreen command to the toolbar.

!History:
*25-07-06: ver 1.1
*20-07-06: ver 1.0

!Code
***/
//{{{
var lewcidFullScreen = false;

config.commands.fullscreen =
{
            text:&quot; ↕ &quot;,
            tooltip:&quot;Fullscreen mode&quot;
};

config.commands.fullscreen.handler = function (event,src,title)
{
            if (lewcidFullScreen == false)
               {
                lewcidFullScreen = true;
                refreshPageTemplate(&quot;FullScreenPageTemplate&quot;);
               }
            else
               {
                lewcidFullScreen = false;
                refreshPageTemplate(&quot;PageTemplate&quot;);
               }
}

var lewcid_fullscreen_closeTiddler = Story.prototype.closeTiddler;
Story.prototype.closeTiddler =function(title,animate,slowly)
{
           lewcid_fullscreen_closeTiddler.apply(this,arguments);
           if (story.isEmpty() &amp;&amp; lewcidFullScreen == true)
              config.commands.fullscreen.handler();
}


Slider.prototype.lewcidStop = Slider.prototype.stop;
Slider.prototype.stop = function()
{
           this.lewcidStop();
           if (story.isEmpty() &amp;&amp; lewcidFullScreen == true)
              config.commands.fullscreen.handler();
}
//}}}</pre>
</div>
<div title="HideWhenPlugin" modifier="dger" created="201008251621" modified="201009301850" tags="systemConfig plugin pluginInfo %tw-elnb">
<pre>/***
|Name:|HideWhenPlugin|
|Description:|Allows conditional inclusion/exclusion in templates|
|Version:|3.1 ($Rev: 3919 $)|
|Date:|$Date: 2008-03-13 02:03:12 +1000 (Thu, 13 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#HideWhenPlugin|
|Author:|Simon Baird &lt;simon.baird@gmail.com&gt;|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
For use in ViewTemplate and EditTemplate. Example usage:
{{{&lt;div macro=&quot;showWhenTagged Task&quot;&gt;[[TaskToolbar]]&lt;/div&gt;}}}
{{{&lt;div macro=&quot;showWhen tiddler.modifier == 'BartSimpson'&quot;&gt;&lt;img src=&quot;bart.gif&quot;/&gt;&lt;/div&gt;}}}
***/
//{{{

window.hideWhenLastTest = false;

window.removeElementWhen = function(test,place) {
	window.hideWhenLastTest = test;
	if (test) {
		removeChildren(place);
		place.parentNode.removeChild(place);
	}
};


merge(config.macros,{

	hideWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( eval(paramString), place);
	}},

	showWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !eval(paramString), place);
	}},

	hideWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.tags.containsAll(params), place);
	}},

	showWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !tiddler.tags.containsAll(params), place);
	}},

	hideWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.tags.containsAny(params), place);
	}},

	showWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !tiddler.tags.containsAny(params), place);
	}},

	hideWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.tags.containsAll(params), place);
	}},

	showWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !tiddler.tags.containsAll(params), place);
	}},

	hideWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0]), place);
	}},

	showWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !(store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0])), place);
	}},

	hideWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.title == params[0], place);
	}},

	showWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.title != params[0], place);
	}},

	'else': { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !window.hideWhenLastTest, place);
	}}

});

//}}}</pre>
</div>
<div title="ImageSizePlugin" modifier="escdie" created="201007171449" modified="201011101811" tags="IconPackage systemConfig plugin pluginInfo %tw-elnb">
<pre>/***
|Name|ImageSizePlugin|
|Source|http://www.TiddlyTools.com/#ImageSizePlugin|
|Version|1.2.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|adds support for resizing images|
This plugin adds optional syntax to scale an image to a specified width and height and/or interactively resize the image with the mouse.
!!!!!Usage
&lt;&lt;&lt;
The extended image syntax is:
{{{
[img(w+,h+)[...][...]]
}}}
where ''(w,h)'' indicates the desired width and height (in CSS units, e.g., px, em, cm, in, or %). Use ''auto'' (or a blank value) for either dimension to scale that dimension proportionally (i.e., maintain the aspect ratio). You can also calculate a CSS value 'on-the-fly' by using a //javascript expression// enclosed between &quot;&quot;&quot;{{&quot;&quot;&quot; and &quot;&quot;&quot;}}&quot;&quot;&quot;. Appending a plus sign (+) to a dimension enables interactive resizing in that dimension (by dragging the mouse inside the image). Use ~SHIFT-click to show the full-sized (un-scaled) image. Use ~CTRL-click to restore the starting size (either scaled or full-sized).
&lt;&lt;&lt;
!!!!!Examples
&lt;&lt;&lt;
{{{
[img(100px+,75px+)[images/meow2.jpg]]
}}}
[img(100px+,75px+)[images/meow2.jpg]]
{{{
[&lt;img(34%+,+)[images/meow.gif]]
[&lt;img(21% ,+)[images/meow.gif]]
[&lt;img(13%+, )[images/meow.gif]]
[&lt;img( 8%+, )[images/meow.gif]]
[&lt;img( 5% , )[images/meow.gif]]
[&lt;img( 3% , )[images/meow.gif]]
[&lt;img( 2% , )[images/meow.gif]]
[img(  1%+,+)[images/meow.gif]]
}}}
[&lt;img(34%+,+)[images/meow.gif]]
[&lt;img(21% ,+)[images/meow.gif]]
[&lt;img(13%+, )[images/meow.gif]]
[&lt;img( 8%+, )[images/meow.gif]]
[&lt;img( 5% , )[images/meow.gif]]
[&lt;img( 3% , )[images/meow.gif]]
[&lt;img( 2% , )[images/meow.gif]]
[img(  1%+,+)[images/meow.gif]]
{{tagClear{
}}}
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.02.24 [1.2.1] cleanup width/height regexp, use '+' suffix for resizing
2009.02.22 [1.2.0] added stretchable images
2008.01.19 [1.1.0] added evaluated width/height values
2008.01.18 [1.0.1] regexp for &quot;(width,height)&quot; now passes all CSS values to browser for validation
2008.01.17 [1.0.0] initial release
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.ImageSizePlugin= {major: 1, minor: 2, revision: 1, date: new Date(2009,2,24)};
//}}}
//{{{
var f=config.formatters[config.formatters.findByField(&quot;name&quot;,&quot;image&quot;)];
f.match=&quot;\\[[&lt;&gt;]?[Ii][Mm][Gg](?:\\([^,]*,[^\\)]*\\))?\\[&quot;;
f.lookaheadRegExp=/\[([&lt;]?)(&gt;?)[Ii][Mm][Gg](?:\(([^,]*),([^\)]*)\))?\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg;
f.handler=function(w) {
	this.lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
	if(lookaheadMatch &amp;&amp; lookaheadMatch.index == w.matchStart) {
		var floatLeft=lookaheadMatch[1];
		var floatRight=lookaheadMatch[2];
		var width=lookaheadMatch[3];
		var height=lookaheadMatch[4];
		var tooltip=lookaheadMatch[5];
		var src=lookaheadMatch[6];
		var link=lookaheadMatch[7];

		// Simple bracketted link
		var e = w.output;
		if(link) { // LINKED IMAGE
			if (config.formatterHelpers.isExternalLink(link)) {
				if (config.macros.attach &amp;&amp; config.macros.attach.isAttachment(link)) {
					// see [[AttachFilePluginFormatters]]
					e = createExternalLink(w.output,link);
					e.href=config.macros.attach.getAttachment(link);
					e.title = config.macros.attach.linkTooltip + link;
				} else
					e = createExternalLink(w.output,link);
			} else 
				e = createTiddlyLink(w.output,link,false,null,w.isStatic);
			addClass(e,&quot;imageLink&quot;);
		}

		var img = createTiddlyElement(e,&quot;img&quot;);
		if(floatLeft) img.align=&quot;left&quot;; else if(floatRight) img.align=&quot;right&quot;;
		if(width||height) {
			var x=width.trim(); var y=height.trim();
			var stretchW=(x.substr(x.length-1,1)=='+'); if (stretchW) x=x.substr(0,x.length-1);
			var stretchH=(y.substr(y.length-1,1)=='+'); if (stretchH) y=y.substr(0,y.length-1);
			if (x.substr(0,2)==&quot;{{&quot;)
				{ try{x=eval(x.substr(2,x.length-4))} catch(e){displayMessage(e.description||e.toString())} }
			if (y.substr(0,2)==&quot;{{&quot;)
				{ try{y=eval(y.substr(2,y.length-4))} catch(e){displayMessage(e.description||e.toString())} }
			img.style.width=x.trim(); img.style.height=y.trim();
			config.formatterHelpers.addStretchHandlers(img,stretchW,stretchH);
		}
		if(tooltip) img.title = tooltip;

		// GET IMAGE SOURCE
		if (config.macros.attach &amp;&amp; config.macros.attach.isAttachment(src))
			src=config.macros.attach.getAttachment(src); // see [[AttachFilePluginFormatters]]
		else if (config.formatterHelpers.resolvePath) { // see [[ImagePathPlugin]]
			if (config.browser.isIE || config.browser.isSafari) {
				img.onerror=(function(){
					this.src=config.formatterHelpers.resolvePath(this.src,false);
					return false;
				});
			} else
				src=config.formatterHelpers.resolvePath(src,true);
		}
		img.src=src;
		w.nextMatch = this.lookaheadRegExp.lastIndex;
	}
}

config.formatterHelpers.addStretchHandlers=function(e,stretchW,stretchH) {
	e.title=((stretchW||stretchH)?'DRAG=stretch/shrink, ':'')
		+'SHIFT-CLICK=show full size, CTRL-CLICK=restore initial size';
	e.statusMsg='width=%0, height=%1';
	e.style.cursor='move';
	e.originalW=e.style.width;
	e.originalH=e.style.height;
	e.minW=Math.max(e.offsetWidth/20,10);
	e.minH=Math.max(e.offsetHeight/20,10);
	e.stretchW=stretchW;
	e.stretchH=stretchH;
	e.onmousedown=function(ev) { var ev=ev||window.event;
		this.sizing=true;
		this.startX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
		this.startY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
		this.startW=this.offsetWidth;
		this.startH=this.offsetHeight;
		return false;
	};
	e.onmousemove=function(ev) { var ev=ev||window.event;
		if (this.sizing) {
			var s=this.style;
			var currX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
			var currY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
			var newW=(currX-this.offsetLeft)/(this.startX-this.offsetLeft)*this.startW;
			var newH=(currY-this.offsetTop )/(this.startY-this.offsetTop )*this.startH;
			if (this.stretchW) s.width =Math.floor(Math.max(newW,this.minW))+'px';
			if (this.stretchH) s.height=Math.floor(Math.max(newH,this.minH))+'px';
			clearMessage(); displayMessage(this.statusMsg.format([s.width,s.height]));
		}
		return false;
	};
	e.onmouseup=function(ev) { var ev=ev||window.event;
		if (ev.shiftKey) { this.style.width=this.style.height=''; }
		if (ev.ctrlKey)  { this.style.width=this.originalW; this.style.height=this.originalH; }
		this.sizing=false;
		clearMessage();
		return false;
	};
	e.onmouseout=function(ev) { var ev=ev||window.event;
		this.sizing=false;
		clearMessage();
		return false;
	};
}
//}}}</pre>
</div>
<div title="IntelliTaggerPlugin" modifier="dger" created="201007171417" modified="201009301850" tags="plugin pluginInfo systemConfig %tw-elnb">
<pre>/***
|''Name:''|IntelliTaggerPlugin|
|''Version:''|1.0.2 (2007-07-25)|
|''Type:''|plugin|
|''Source:''|http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin|
|''Author:''|Udo Borkowski (ub [at] abego-software [dot] de)|
|''Documentation:''|[[IntelliTaggerPlugin Documentation]]|
|''~SourceCode:''|[[IntelliTaggerPlugin SourceCode]]|
|''Licence:''|[[BSD open source license (abego Software)]]|
|''~CoreVersion:''|2.0.8|
|''Browser:''|Firefox 1.5.0.2 or better|
***/
/***
!Version History
* 1.0.2 (2007-07-25): 
** Feature: &quot;Return&quot; key may be used to accept first tag suggestion (beside &quot;Alt-1&quot;)
** Bugfix: Keyboard shortcuts (Alt+3 etc.) shifted
* 1.0.1 (2007-05-18): Improvement: Speedup when using TiddlyWikis with many tags
* 1.0.0 (2006-04-26): Initial release

***/
// /%
if(!version.extensions.IntelliTaggerPlugin){if(!window.abego){window.abego={};}if(!abego.internal){abego.internal={};}abego.alertAndThrow=function(s){alert(s);throw s;};if(version.major&lt;2){abego.alertAndThrow(&quot;Use TiddlyWiki 2.0.8 or better to run the IntelliTagger Plugin.&quot;);}version.extensions.IntelliTaggerPlugin={major:1,minor:0,revision:2,date:new Date(2007,6,25),type:&quot;plugin&quot;,source:&quot;http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin&quot;,documentation:&quot;[[IntelliTaggerPlugin Documentation]]&quot;,sourcecode:&quot;[[IntelliTaggerPlugin SourceCode]]&quot;,author:&quot;Udo Borkowski (ub [at] abego-software [dot] de)&quot;,licence:&quot;[[BSD open source license (abego Software)]]&quot;,tiddlywiki:&quot;Version 2.0.8 or better&quot;,browser:&quot;Firefox 1.5.0.2 or better&quot;};abego.createEllipsis=function(_2){var e=createTiddlyElement(_2,&quot;span&quot;);e.innerHTML=&quot;&amp;hellip;&quot;;};abego.isPopupOpen=function(_4){return _4&amp;&amp;_4.parentNode==document.body;};abego.openAsPopup=function(_5){if(_5.parentNode!=document.body){document.body.appendChild(_5);}};abego.closePopup=function(_6){if(abego.isPopupOpen(_6)){document.body.removeChild(_6);}};abego.getWindowRect=function(){return {left:findScrollX(),top:findScrollY(),height:findWindowHeight(),width:findWindowWidth()};};abego.moveElement=function(_7,_8,_9){_7.style.left=_8+&quot;px&quot;;_7.style.top=_9+&quot;px&quot;;};abego.centerOnWindow=function(_a){if(_a.style.position!=&quot;absolute&quot;){throw &quot;abego.centerOnWindow: element must have absolute position&quot;;}var _b=abego.getWindowRect();abego.moveElement(_a,_b.left+(_b.width-_a.offsetWidth)/2,_b.top+(_b.height-_a.offsetHeight)/2);};abego.isDescendantOrSelf=function(_c,e){while(e){if(_c==e){return true;}e=e.parentNode;}return false;};abego.toSet=function(_e){var _f={};for(var i=0;i&lt;_e.length;i++){_f[_e[i]]=true;}return _f;};abego.filterStrings=function(_11,_12,_13){var _14=[];for(var i=0;i&lt;_11.length&amp;&amp;(_13===undefined||_14.length&lt;_13);i++){var s=_11[i];if(s.match(_12)){_14.push(s);}}return _14;};abego.arraysAreEqual=function(a,b){if(!a){return !b;}if(!b){return false;}var n=a.length;if(n!=b.length){return false;}for(var i=0;i&lt;n;i++){if(a[i]!=b[i]){return false;}}return true;};abego.moveBelowAndClip=function(_1b,_1c){if(!_1c){return;}var _1d=findPosX(_1c);var _1e=findPosY(_1c);var _1f=_1c.offsetHeight;var _20=_1d;var _21=_1e+_1f;var _22=findWindowWidth();if(_22&lt;_1b.offsetWidth){_1b.style.width=(_22-100)+&quot;px&quot;;}var _23=_1b.offsetWidth;if(_20+_23&gt;_22){_20=_22-_23-30;}if(_20&lt;0){_20=0;}_1b.style.left=_20+&quot;px&quot;;_1b.style.top=_21+&quot;px&quot;;_1b.style.display=&quot;block&quot;;};abego.compareStrings=function(a,b){return (a==b)?0:(a&lt;b)?-1:1;};abego.sortIgnoreCase=function(arr){var _27=[];var n=arr.length;for(var i=0;i&lt;n;i++){var s=arr[i];_27.push([s.toString().toLowerCase(),s]);}_27.sort(function(a,b){return (a[0]==b[0])?0:(a[0]&lt;b[0])?-1:1;});for(i=0;i&lt;n;i++){arr[i]=_27[i][1];}};abego.getTiddlerField=function(_2d,_2e,_2f){var _30=document.getElementById(_2d.idPrefix+_2e);var e=null;if(_30!=null){var _32=_30.getElementsByTagName(&quot;*&quot;);for(var t=0;t&lt;_32.length;t++){var c=_32[t];if(c.tagName.toLowerCase()==&quot;input&quot;||c.tagName.toLowerCase()==&quot;textarea&quot;){if(!e){e=c;}if(c.getAttribute(&quot;edit&quot;)==_2f){e=c;}}}}return e;};abego.setRange=function(_35,_36,end){if(_35.setSelectionRange){_35.setSelectionRange(_36,end);var max=0+_35.scrollHeight;var len=_35.textLength;var top=max*_36/len,bot=max*end/len;_35.scrollTop=Math.min(top,(bot+top-_35.clientHeight)/2);}else{if(_35.createTextRange!=undefined){var _3b=_35.createTextRange();_3b.collapse();_3b.moveEnd(&quot;character&quot;,end);_3b.moveStart(&quot;character&quot;,_36);_3b.select();}else{_35.select();}}};abego.internal.TagManager=function(){var _3c=null;var _3d=function(){if(_3c){return;}_3c={};store.forEachTiddler(function(_3e,_3f){for(var i=0;i&lt;_3f.tags.length;i++){var tag=_3f.tags[i];var _42=_3c[tag];if(!_42){_42=_3c[tag]={count:0,tiddlers:{}};}_42.tiddlers[_3f.title]=true;_42.count+=1;}});};var _43=TiddlyWiki.prototype.saveTiddler;TiddlyWiki.prototype.saveTiddler=function(_44,_45,_46,_47,_48,_49){var _4a=this.fetchTiddler(_44);var _4b=_4a?_4a.tags:[];var _4c=(typeof _49==&quot;string&quot;)?_49.readBracketedList():_49;_43.apply(this,arguments);if(!abego.arraysAreEqual(_4b,_4c)){abego.internal.getTagManager().reset();}};var _4d=TiddlyWiki.prototype.removeTiddler;TiddlyWiki.prototype.removeTiddler=function(_4e){var _4f=this.fetchTiddler(_4e);var _50=_4f&amp;&amp;_4f.tags.length&gt;0;_4d.apply(this,arguments);if(_50){abego.internal.getTagManager().reset();}};this.reset=function(){_3c=null;};this.getTiddlersWithTag=function(tag){_3d();var _52=_3c[tag];return _52?_52.tiddlers:null;};this.getAllTags=function(_53){_3d();var _54=[];for(var i in _3c){_54.push(i);}for(i=0;_53&amp;&amp;i&lt;_53.length;i++){_54.pushUnique(_53[i],true);}abego.sortIgnoreCase(_54);return _54;};this.getTagInfos=function(){_3d();var _56=[];for(var _57 in _3c){_56.push([_57,_3c[_57]]);}return _56;};var _58=function(a,b){var a1=a[1];var b1=b[1];var d=b[1].count-a[1].count;return d!=0?d:abego.compareStrings(a[0].toLowerCase(),b[0].toLowerCase());};this.getSortedTagInfos=function(){_3d();var _5e=this.getTagInfos();_5e.sort(_58);return _5e;};this.getPartnerRankedTags=function(_5f){var _60={};for(var i=0;i&lt;_5f.length;i++){var _62=this.getTiddlersWithTag(_5f[i]);for(var _63 in _62){var _64=store.getTiddler(_63);if(!(_64 instanceof Tiddler)){continue;}for(var j=0;j&lt;_64.tags.length;j++){var tag=_64.tags[j];var c=_60[tag];_60[tag]=c?c+1:1;}}}var _68=abego.toSet(_5f);var _69=[];for(var n in _60){if(!_68[n]){_69.push(n);}}_69.sort(function(a,b){var d=_60[b]-_60[a];return d!=0?d:abego.compareStrings(a.toLowerCase(),b.toLowerCase());});return _69;};};abego.internal.getTagManager=function(){if(!abego.internal.gTagManager){abego.internal.gTagManager=new abego.internal.TagManager();}return abego.internal.gTagManager;};(function(){var _6e=2;var _6f=1;var _70=30;var _71;var _72;var _73;var _74;var _75;var _76;if(!abego.IntelliTagger){abego.IntelliTagger={};}var _77=function(){return _72;};var _78=function(tag){return _75[tag];};var _7a=function(s){var i=s.lastIndexOf(&quot; &quot;);return (i&gt;=0)?s.substr(0,i):&quot;&quot;;};var _7d=function(_7e){var s=_7e.value;var len=s.length;return (len&gt;0&amp;&amp;s[len-1]!=&quot; &quot;);};var _81=function(_82){var s=_82.value;var len=s.length;if(len&gt;0&amp;&amp;s[len-1]!=&quot; &quot;){_82.value+=&quot; &quot;;}};var _85=function(tag,_87,_88){if(_7d(_87)){_87.value=_7a(_87.value);}story.setTiddlerTag(_88.title,tag,0);_81(_87);abego.IntelliTagger.assistTagging(_87,_88);};var _89=function(n){if(_76&amp;&amp;_76.length&gt;n){return _76[n];}return (_74&amp;&amp;_74.length&gt;n)?_74[n]:null;};var _8b=function(n,_8d,_8e){var _8f=_89(n);if(_8f){_85(_8f,_8d,_8e);}};var _90=function(_91){var pos=_91.value.lastIndexOf(&quot; &quot;);var _93=(pos&gt;=0)?_91.value.substr(++pos,_91.value.length):_91.value;return new RegExp(_93.escapeRegExp(),&quot;i&quot;);};var _94=function(_95,_96){var _97=0;for(var i=0;i&lt;_95.length;i++){if(_96[_95[i]]){_97++;}}return _97;};var _99=function(_9a,_9b,_9c){var _9d=1;var c=_9a[_9b];for(var i=_9b+1;i&lt;_9a.length;i++){if(_9a[i][1].count==c){if(_9a[i][0].match(_9c)){_9d++;}}else{break;}}return _9d;};var _a0=function(_a1,_a2){var _a3=abego.internal.getTagManager().getSortedTagInfos();var _a4=[];var _a5=0;for(var i=0;i&lt;_a3.length;i++){var c=_a3[i][1].count;if(c!=_a5){if(_a2&amp;&amp;(_a4.length+_99(_a3,i,_a1)&gt;_a2)){break;}_a5=c;}if(c==1){break;}var s=_a3[i][0];if(s.match(_a1)){_a4.push(s);}}return _a4;};var _a9=function(_aa,_ab){return abego.filterStrings(abego.internal.getTagManager().getAllTags(_ab),_aa);};var _ac=function(){if(!_71){return;}var _ad=store.getTiddlerText(&quot;IntelliTaggerMainTemplate&quot;);if(!_ad){_ad=&quot;&lt;b&gt;Tiddler IntelliTaggerMainTemplate not found&lt;/b&gt;&quot;;}_71.innerHTML=_ad;applyHtmlMacros(_71,null);refreshElements(_71,null);};var _ae=function(e){if(!e){var e=window.event;}var tag=this.getAttribute(&quot;tag&quot;);if(_73){_73.call(this,tag,e);}return false;};var _b2=function(_b3){createTiddlyElement(_b3,&quot;span&quot;,null,&quot;tagSeparator&quot;,&quot; | &quot;);};var _b4=function(_b5,_b6,_b7,_b8,_b9){if(!_b6){return;}var _ba=_b8?abego.toSet(_b8):{};var n=_b6.length;var c=0;for(var i=0;i&lt;n;i++){var tag=_b6[i];if(_ba[tag]){continue;}if(c&gt;0){_b2(_b5);}if(_b9&amp;&amp;c&gt;=_b9){abego.createEllipsis(_b5);break;}c++;var _bf=&quot;&quot;;var _c0=_b5;if(_b7&lt;10){_c0=createTiddlyElement(_b5,&quot;span&quot;,null,&quot;numberedSuggestion&quot;);_b7++;var key=_b7&lt;10?&quot;&quot;+(_b7):&quot;0&quot;;createTiddlyElement(_c0,&quot;span&quot;,null,&quot;suggestionNumber&quot;,key+&quot;) &quot;);var _c2=_b7==1?&quot;Return or &quot;:&quot;&quot;;_bf=&quot; (Shortcut: %1Alt-%0)&quot;.format([key,_c2]);}var _c3=config.views.wikified.tag.tooltip.format([tag]);var _c4=(_78(tag)?&quot;Remove tag '%0'%1&quot;:&quot;Add tag '%0'%1&quot;).format([tag,_bf]);var _c5=&quot;%0; Shift-Click: %1&quot;.format([_c4,_c3]);var btn=createTiddlyButton(_c0,tag,_c5,_ae,_78(tag)?&quot;currentTag&quot;:null);btn.setAttribute(&quot;tag&quot;,tag);}};var _c7=function(){if(_71){window.scrollTo(0,ensureVisible(_71));}if(_77()){window.scrollTo(0,ensureVisible(_77()));}};var _c8=function(e){if(!e){var e=window.event;}if(!_71){return;}var _cb=resolveTarget(e);if(_cb==_77()){return;}if(abego.isDescendantOrSelf(_71,_cb)){return;}abego.IntelliTagger.close();};addEvent(document,&quot;click&quot;,_c8);var _cc=Story.prototype.gatherSaveFields;Story.prototype.gatherSaveFields=function(e,_ce){_cc.apply(this,arguments);var _cf=_ce.tags;if(_cf){_ce.tags=_cf.trim();}};var _d0=function(_d1){story.focusTiddler(_d1,&quot;tags&quot;);var _d2=abego.getTiddlerField(story,_d1,&quot;tags&quot;);if(_d2){var len=_d2.value.length;abego.setRange(_d2,len,len);window.scrollTo(0,ensureVisible(_d2));}};var _d4=config.macros.edit.handler;config.macros.edit.handler=function(_d5,_d6,_d7,_d8,_d9,_da){_d4.apply(this,arguments);var _db=_d7[0];if((_da instanceof Tiddler)&amp;&amp;_db==&quot;tags&quot;){var _dc=_d5.lastChild;_dc.onfocus=function(e){abego.IntelliTagger.assistTagging(_dc,_da);setTimeout(function(){_d0(_da.title);},100);};_dc.onkeyup=function(e){if(!e){var e=window.event;}if(e.altKey&amp;&amp;!e.ctrlKey&amp;&amp;!e.metaKey&amp;&amp;(e.keyCode&gt;=48&amp;&amp;e.keyCode&lt;=57)){_8b(e.keyCode==48?9:e.keyCode-49,_dc,_da);}else{if(e.ctrlKey&amp;&amp;e.keyCode==32){_8b(0,_dc,_da);}}if(!e.ctrlKey&amp;&amp;(e.keyCode==13||e.keyCode==10)){_8b(0,_dc,_da);}setTimeout(function(){abego.IntelliTagger.assistTagging(_dc,_da);},100);return false;};_81(_dc);}};var _e0=function(e){if(!e){var e=window.event;}var _e3=resolveTarget(e);var _e4=_e3.getAttribute(&quot;tiddler&quot;);if(_e4){story.displayTiddler(_e3,_e4,&quot;IntelliTaggerEditTagsTemplate&quot;,false);_d0(_e4);}return false;};var _e5=config.macros.tags.handler;config.macros.tags.handler=function(_e6,_e7,_e8,_e9,_ea,_eb){_e5.apply(this,arguments);abego.IntelliTagger.createEditTagsButton(_eb,createTiddlyElement(_e6.lastChild,&quot;li&quot;));};var _ec=function(){if(_71&amp;&amp;_72&amp;&amp;!abego.isDescendantOrSelf(document,_72)){abego.IntelliTagger.close();}};setInterval(_ec,100);abego.IntelliTagger.displayTagSuggestions=function(_ed,_ee,_ef,_f0,_f1){_74=_ed;_75=abego.toSet(_ee);_76=_ef;_72=_f0;_73=_f1;if(!_71){_71=createTiddlyElement(document.body,&quot;div&quot;,null,&quot;intelliTaggerSuggestions&quot;);_71.style.position=&quot;absolute&quot;;}_ac();abego.openAsPopup(_71);if(_77()){var w=_77().offsetWidth;if(_71.offsetWidth&lt;w){_71.style.width=(w-2*(_6e+_6f))+&quot;px&quot;;}abego.moveBelowAndClip(_71,_77());}else{abego.centerOnWindow(_71);}_c7();};abego.IntelliTagger.assistTagging=function(_f3,_f4){var _f5=_90(_f3);var s=_f3.value;if(_7d(_f3)){s=_7a(s);}var _f7=s.readBracketedList();var _f8=_f7.length&gt;0?abego.filterStrings(abego.internal.getTagManager().getPartnerRankedTags(_f7),_f5,_70):_a0(_f5,_70);abego.IntelliTagger.displayTagSuggestions(_a9(_f5,_f7),_f7,_f8,_f3,function(tag,e){if(e.shiftKey){onClickTag.call(this,e);}else{_85(tag,_f3,_f4);}});};abego.IntelliTagger.close=function(){abego.closePopup(_71);_71=null;return false;};abego.IntelliTagger.createEditTagsButton=function(_fb,_fc,_fd,_fe,_ff,id,_101){if(!_fd){_fd=&quot;[edit]&quot;;}if(!_fe){_fe=&quot;Edit the tags&quot;;}if(!_ff){_ff=&quot;editTags&quot;;}var _102=createTiddlyButton(_fc,_fd,_fe,_e0,_ff,id,_101);_102.setAttribute(&quot;tiddler&quot;,(_fb instanceof Tiddler)?_fb.title:String(_fb));return _102;};abego.IntelliTagger.getSuggestionTagsMaxCount=function(){return 100;};config.macros.intelliTagger={label:&quot;intelliTagger&quot;,handler:function(_103,_104,_105,_106,_107,_108){var _109=_107.parseParams(&quot;list&quot;,null,true);var _10a=_109[0][&quot;action&quot;];for(var i=0;_10a&amp;&amp;i&lt;_10a.length;i++){var _10c=_10a[i];var _10d=config.macros.intelliTagger.subhandlers[_10c];if(!_10d){abego.alertAndThrow(&quot;Unsupported action '%0'&quot;.format([_10c]));}_10d(_103,_104,_105,_106,_107,_108);}},subhandlers:{showTags:function(_10e,_10f,_110,_111,_112,_113){_b4(_10e,_74,_76?_76.length:0,_76,abego.IntelliTagger.getSuggestionTagsMaxCount());},showFavorites:function(_114,_115,_116,_117,_118,_119){_b4(_114,_76,0);},closeButton:function(_11a,_11b,_11c,_11d,_11e,_11f){var _120=createTiddlyButton(_11a,&quot;close&quot;,&quot;Close the suggestions&quot;,abego.IntelliTagger.close);},version:function(_121){var t=&quot;IntelliTagger %0.%1.%2&quot;.format([version.extensions.IntelliTaggerPlugin.major,version.extensions.IntelliTaggerPlugin.minor,version.extensions.IntelliTaggerPlugin.revision]);var e=createTiddlyElement(_121,&quot;a&quot;);e.setAttribute(&quot;href&quot;,&quot;http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin&quot;);e.innerHTML=&quot;&lt;font color=\&quot;black\&quot; face=\&quot;Arial, Helvetica, sans-serif\&quot;&gt;&quot;+t+&quot;&lt;font&gt;&quot;;},copyright:function(_124){var e=createTiddlyElement(_124,&quot;a&quot;);e.setAttribute(&quot;href&quot;,&quot;http://tiddlywiki.abego-software.de&quot;);e.innerHTML=&quot;&lt;font color=\&quot;black\&quot; face=\&quot;Arial, Helvetica, sans-serif\&quot;&gt;&amp;copy; 2006-2007 &lt;b&gt;&lt;font color=\&quot;red\&quot;&gt;abego&lt;/font&gt;&lt;/b&gt; Software&lt;font&gt;&quot;;}}};})();config.shadowTiddlers[&quot;IntelliTaggerStyleSheet&quot;]=&quot;/***\n&quot;+&quot;!~IntelliTagger Stylesheet\n&quot;+&quot;***/\n&quot;+&quot;/*{{{*/\n&quot;+&quot;.intelliTaggerSuggestions {\n&quot;+&quot;\tposition: absolute;\n&quot;+&quot;\twidth: 600px;\n&quot;+&quot;\n&quot;+&quot;\tpadding: 2px;\n&quot;+&quot;\tlist-style: none;\n&quot;+&quot;\tmargin: 0;\n&quot;+&quot;\n&quot;+&quot;\tbackground: #eeeeee;\n&quot;+&quot;\tborder: 1px solid DarkGray;\n&quot;+&quot;}\n&quot;+&quot;\n&quot;+&quot;.intelliTaggerSuggestions .currentTag   {\n&quot;+&quot;\tfont-weight: bold;\n&quot;+&quot;}\n&quot;+&quot;\n&quot;+&quot;.intelliTaggerSuggestions .suggestionNumber {\n&quot;+&quot;\tcolor: #808080;\n&quot;+&quot;}\n&quot;+&quot;\n&quot;+&quot;.intelliTaggerSuggestions .numberedSuggestion{\n&quot;+&quot;\twhite-space: nowrap;\n&quot;+&quot;}\n&quot;+&quot;\n&quot;+&quot;.intelliTaggerSuggestions .intelliTaggerFooter {\n&quot;+&quot;\tmargin-top: 4px;\n&quot;+&quot;\tborder-top-width: thin;\n&quot;+&quot;\tborder-top-style: solid;\n&quot;+&quot;\tborder-top-color: #999999;\n&quot;+&quot;}\n&quot;+&quot;.intelliTaggerSuggestions .favorites {\n&quot;+&quot;\tborder-bottom-width: thin;\n&quot;+&quot;\tborder-bottom-style: solid;\n&quot;+&quot;\tborder-bottom-color: #999999;\n&quot;+&quot;\tpadding-bottom: 2px;\n&quot;+&quot;}\n&quot;+&quot;\n&quot;+&quot;.intelliTaggerSuggestions .normalTags {\n&quot;+&quot;\tpadding-top: 2px;\n&quot;+&quot;}\n&quot;+&quot;\n&quot;+&quot;.intelliTaggerSuggestions .intelliTaggerFooter .button {\n&quot;+&quot;\tfont-size: 10px;\n&quot;+&quot;\n&quot;+&quot;\tpadding-left: 0.3em;\n&quot;+&quot;\tpadding-right: 0.3em;\n&quot;+&quot;}\n&quot;+&quot;\n&quot;+&quot;/*}}}*/\n&quot;;config.shadowTiddlers[&quot;IntelliTaggerMainTemplate&quot;]=&quot;&lt;!--\n&quot;+&quot;{{{\n&quot;+&quot;--&gt;\n&quot;+&quot;&lt;div class=\&quot;favorites\&quot; macro=\&quot;intelliTagger action: showFavorites\&quot;&gt;&lt;/div&gt;\n&quot;+&quot;&lt;div class=\&quot;normalTags\&quot; macro=\&quot;intelliTagger action: showTags\&quot;&gt;&lt;/div&gt;\n&quot;+&quot;&lt;!-- The Footer (with the Navigation) ============================================ --&gt;\n&quot;+&quot;&lt;table class=\&quot;intelliTaggerFooter\&quot; border=\&quot;0\&quot; width=\&quot;100%\&quot; cellspacing=\&quot;0\&quot; cellpadding=\&quot;0\&quot;&gt;&lt;tbody&gt;\n&quot;+&quot;  &lt;tr&gt;\n&quot;+&quot;\t&lt;td align=\&quot;left\&quot;&gt;\n&quot;+&quot;\t\t&lt;span macro=\&quot;intelliTagger action: closeButton\&quot;&gt;&lt;/span&gt;\n&quot;+&quot;\t&lt;/td&gt;\n&quot;+&quot;\t&lt;td align=\&quot;right\&quot;&gt;\n&quot;+&quot;\t\t&lt;span macro=\&quot;intelliTagger action: version\&quot;&gt;&lt;/span&gt;, &lt;span macro=\&quot;intelliTagger action: copyright \&quot;&gt;&lt;/span&gt;\n&quot;+&quot;\t&lt;/td&gt;\n&quot;+&quot;  &lt;/tr&gt;\n&quot;+&quot;&lt;/tbody&gt;&lt;/table&gt;\n&quot;+&quot;&lt;!--\n&quot;+&quot;}}}\n&quot;+&quot;--&gt;\n&quot;;config.shadowTiddlers[&quot;IntelliTaggerEditTagsTemplate&quot;]=&quot;&lt;!--\n&quot;+&quot;{{{\n&quot;+&quot;--&gt;\n&quot;+&quot;&lt;div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler'&gt;&lt;/div&gt;\n&quot;+&quot;&lt;div class='title' macro='view title'&gt;&lt;/div&gt;\n&quot;+&quot;&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;\n&quot;+&quot;&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;\n&quot;+&quot;&lt;div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler'&gt;&lt;/div&gt;\n&quot;+&quot;&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;&lt;span macro='tagChooser'&gt;&lt;/span&gt;&lt;/div&gt;\n&quot;+&quot;&lt;!--\n&quot;+&quot;}}}\n&quot;+&quot;--&gt;\n&quot;;config.shadowTiddlers[&quot;BSD open source license (abego Software)&quot;]=&quot;See [[Licence|http://tiddlywiki.abego-software.de/#%5B%5BBSD%20open%20source%20license%5D%5D]].&quot;;config.shadowTiddlers[&quot;IntelliTaggerPlugin Documentation&quot;]=&quot;[[Documentation on abego Software website|http://tiddlywiki.abego-software.de/doc/IntelliTagger.pdf]].&quot;;config.shadowTiddlers[&quot;IntelliTaggerPlugin SourceCode&quot;]=&quot;[[Plugin source code on abego Software website|http://tiddlywiki.abego-software.de/archive/IntelliTaggerPlugin/Plugin-IntelliTagger-src.1.0.2.js]]\n&quot;;(function(){var _126=restart;restart=function(){setStylesheet(store.getTiddlerText(&quot;IntelliTaggerStyleSheet&quot;),&quot;IntelliTaggerStyleSheet&quot;);_126.apply(this,arguments);};})();}
// %/</pre>
</div>
<div title="LaunchApplication Plugin" modifier="escdie" created="201011181015" modified="" tags="plugin systemConfig %tw-elnb">
<pre>/***
|''Name:''|LaunchApplicationPlugin|
|''Author:''|Lyall Pearce|
|''Source:''|http://www.Remotely-Helpful.com/TiddlyWiki/LaunchApplication.html|
|''License:''|[[Creative Commons Attribution-Share Alike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''Version:''|1.4.0|
|''~CoreVersion:''|2.3.0|
|''Requires:''| |
|''Overrides:''| |
|''Description:''|Launch an application from within TiddlyWiki using a button|
!!!!!Usage
&lt;&lt;&lt;
{{{&lt;&lt;LaunchApplication &quot;buttonLabel&quot; &quot;tooltip&quot; &quot;application&quot; [&quot;arguments&quot; ...]&gt;&gt;}}}
{{{&lt;&lt;LaunchApplicationButton &quot;buttonLabel&quot; &quot;tooltip&quot; &quot;application&quot; [&quot;arguments&quot; ...]&gt;&gt;}}}
{{{&lt;&lt;LaunchApplicationLink &quot;buttonLabel&quot; &quot;tooltip&quot; &quot;application&quot; [&quot;arguments&quot; ...]&gt;&gt;}}}
* buttonLabel is anything you like
* tooltip is anything you like
* application is a path to the executable (which is Operating System dependant)
* arguments is any command line arguments the application requires.
* You must supply relative path from the location of the TiddlyWiki OR a fully qualified path
* Forward slashes works fine for Windows

{{{&lt;&lt;LaunchApplication...&gt;&gt;}}} functions the same as {{{&lt;&lt;LaunchApplicationButton...&gt;&gt;}}}

eg.

{{{
&lt;&lt;LaunchApplicationButton &quot;Emacs&quot; &quot;Linux Emacs&quot; &quot;file:///usr/bin/emacs&quot;&gt;&gt;
}}}
&lt;&lt;LaunchApplicationButton &quot;Emacs&quot; &quot;Linux Emacs&quot; &quot;file:///usr/bin/emacs&quot;&gt;&gt;

{{{
&lt;&lt;LaunchApplicationLink &quot;LocalProgram&quot; &quot;Program relative to Tiddly html file&quot; &quot;localDir/bin/emacs&quot;&gt;&gt;
}}}
&lt;&lt;LaunchApplicationLink &quot;LocalProgram&quot; &quot;Program relative to Tiddly html file&quot; &quot;localDir/bin/emacs&quot;&gt;&gt;
					     
{{{
&lt;&lt;LaunchApplicationButton &quot;Open Notepad&quot; &quot;Text Editing&quot; &quot;file:///e:/Windows/notepad.exe&quot;&gt;&gt;
}}}
&lt;&lt;LaunchApplicationButton &quot;Open Notepad&quot; &quot;Text Editing&quot; &quot;file:///e:/Windows/notepad.exe&quot;&gt;&gt;

{{{
&lt;&lt;LaunchApplicationLink &quot;C Drive&quot; &quot;Folder&quot; &quot;file:///c:/&quot;&gt;&gt;
}}}
&lt;&lt;LaunchApplicationLink &quot;C Drive&quot; &quot;Folder&quot; &quot;file:///c:/&quot;&gt;&gt;


!!!!!Revision History
* 1.1.0 - leveraged some tweaks from from Bradly Meck's version (http://bradleymeck.tiddlyspot.com/#LaunchApplicationPlugin) and the example text.
* 1.2.0 - Make launching work in Linux too and use displayMessage() to give diagnostics/status info.
* 1.3.0 - execute programs relative to TiddlyWiki html file plus fix to args for firefox.
* 1.3.1 - parameters to the macro are properly parsed, allowing dynamic paramters using {{{ {{javascript}} }}} notation.
* 1.4.0 - updated core version and fixed empty tooltip and added launch link capability

&lt;&lt;&lt;
***/
//{{{
version.extensions.LaunchApplication = {major: 1, minor: 4, revision: 0, date: new Date(2007,12,29)};
config.macros.LaunchApplication = {};
config.macros.LaunchApplicationButton = {};
config.macros.LaunchApplicationLink = {};

function LaunchApplication(appToLaunch,appParams) {
    if(! appToLaunch)
	return;
    var tiddlyBaseDir = self.location.pathname.substring(0,self.location.pathname.lastIndexOf(&quot;\\&quot;)+1);
    if(!tiddlyBaseDir || tiddlyBaseDir == &quot;&quot;) {
	tiddlyBaseDir = self.location.pathname.substring(0,self.location.pathname.lastIndexOf(&quot;/&quot;)+1);
    }
    // if Returns with a leading slash, we don't want that.
    if(tiddlyBaseDir.substring(0,1) == &quot;/&quot;) {
	tiddlyBaseDir = tiddlyBaseDir.substring(1);
    }
    if(appToLaunch.indexOf(&quot;file:///&quot;) == 0) // windows would have C:\ as the resulting file
    {
	tiddlyBaseDir = &quot;&quot;;
	appToLaunch = appToLaunch.substring(8);
    }

    if (config.browser.isIE) {
	// want where the tiddly is actually located, excluding tiddly html file

	var theShell = new ActiveXObject(&quot;WScript.Shell&quot;);
	if(theShell) {
            // the app name may have a directory component, need that too
	    // as we want to start with current working dir as the location
	    // of the app.
	    var appDir = appToLaunch.substring(0, appToLaunch.lastIndexOf(&quot;\\&quot;));
	    if(! appDir || appDir == &quot;&quot;) {
		appDir = appToLaunch.substring(0, appToLaunch.lastIndexOf(&quot;/&quot;));
	    }
	    appParams = appParams.length &gt; 0 ? &quot; \&quot;&quot;+appParams.join(&quot;\&quot; \&quot;&quot;)+&quot;\&quot;&quot; : &quot;&quot;;
	    try {
		theShell.CurrentDirectory = decodeURI(tiddlyBaseDir + appDir);
		var commandString = ('&quot;' +decodeURI(tiddlyBaseDir+appToLaunch) + '&quot; ' + appParams);
		pluginInfo.log.push(commandString);
	        theShell.run(commandString);
	    } catch (e) {
		displayMessage(&quot;LaunchApplication cannot locate/execute file '&quot;+tiddlyBaseDir+appToLaunch+&quot;'&quot;);
		return;
	    }
	} else {
	    displayMessage(&quot;LaunchApplication failed to create ActiveX component WScript.Shell&quot;);
	}
    } else { // Not IE
	// want where the tiddly is actually located, excluding tiddly html file
	netscape.security.PrivilegeManager.enablePrivilege(&quot;UniversalXPConnect&quot;);
        var file = Components.classes[&quot;@mozilla.org/file/local;1&quot;].createInstance(Components.interfaces.nsILocalFile);
        var launchString;
	try { // try linux/unix format
            launchString = decodeURI(tiddlyBaseDir+appToLaunch);
	    file.initWithPath(launchString);
	} catch (e) {
	    try { // leading slash on tiddlyBaseDir
                launchString = decodeURI(&quot;/&quot;+tiddlyBaseDir+appToLaunch);
		file.initWithPath(launchString);
	    } catch (e) {
		try { // try windows format
		    launchString = decodeURI(appToLaunch).replace(/\//g,&quot;\\&quot;);
		    file.initWithPath(launchString);
		} catch (e) {
		    try { // try windows format
			launchString = decodeURI(tiddlyBaseDir+appToLaunch).replace(/\//g,&quot;\\&quot;);
			file.initWithPath(launchString);
		    } catch (e) {
			displayMessage(&quot;LaunchApplication cannot locate file '&quot;+launchString+&quot;' : &quot;+e);
			return;
		    } // try windows mode
		} // try windows mode
	    }; // try with leading slash in tiddlyBaseDir
	}; // try linux/unix mode
	try {
	    if (file.isFile() &amp;&amp; file.isExecutable()) {
		displayMessage(&quot;LaunchApplication executing '&quot;+launchString+&quot;' &quot;+appParams.join(&quot; &quot;));
		var process = Components.classes['@mozilla.org/process/util;1'].createInstance(Components.interfaces.nsIProcess);
		process.init(file);
		process.run(false, appParams, appParams.length);
	    }
	    else
	    {
		displayMessage(&quot;LaunchApplication launching '&quot;+launchString+&quot;' &quot;+appParams.join(&quot; &quot;));
		file.launch(); // No args available with this option
	    }
	} catch (e) {
	    displayMessage(&quot;LaunchApplication cannot execute/launch file '&quot;+launchString+&quot;'&quot;);
	}
    }
};

config.macros.LaunchApplication.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
    // 0=ButtonText, 1=toolTip, 2=AppToLaunch, 3...AppParameters
    if (params[0] &amp;&amp; (params[1] || params[1] == &quot;&quot;) &amp;&amp; params[2]) {
        var theButton = createTiddlyButton(place, getParam(params,&quot;buttonText&quot;,params[0]), getParam(params,&quot;toolTip&quot;,params[1]), onClickLaunchApplication);
        theButton.setAttribute(&quot;appToLaunch&quot;, getParam(params,&quot;appToLaunch&quot;,params[2]));
        params.splice(0,3);
        theButton.setAttribute(&quot;appParameters&quot;, params.join(&quot; &quot;));
        return;
    }
}
config.macros.LaunchApplicationButton.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
    config.macros.LaunchApplication.handler (place,macroName,params,wikifier,paramString,tiddler);
}

config.macros.LaunchApplicationLink.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
    // 0=ButtonText, 1=toolTip, 2=AppToLaunch, 3...AppParameters
    if (params[0] &amp;&amp; (params[1] || params[1] == &quot;&quot;) &amp;&amp; params[2]) {
        //var theLink = createExternalLink(place, getParam(params,&quot;buttonText&quot;,params[0]));
        var theLink = createTiddlyButton(place, getParam(params,&quot;buttonText&quot;,params[0]), getParam(params,&quot;toolTip&quot;,params[1]), onClickLaunchApplication,&quot;link&quot;);
        theLink.setAttribute(&quot;appToLaunch&quot;, getParam(params,&quot;appToLaunch&quot;,params[2]));
        params.splice(0,3);
        theLink.setAttribute(&quot;appParameters&quot;, params.join(&quot; &quot;));
        return;
    }
}

function onClickLaunchApplication(e) {
	var theAppToLaunch = this.getAttribute(&quot;appToLaunch&quot;);
	var theAppParams = this.getAttribute(&quot;appParameters&quot;).readMacroParams();
	LaunchApplication(theAppToLaunch,theAppParams);
}

//}}}
</pre>
</div>
<div title="MatchTagsPlugin" modifier="dger" created="201007171450" modified="201009301852" tags="systemConfig plugin %tw-elnb">
<pre>/***
|Name|MatchTagsPlugin|
|Source|http://www.TiddlyTools.com/#MatchTagsPlugin|
|Documentation|http://www.TiddlyTools.com/#MatchTagsPluginInfo|
|Version|2.0.3|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|'tag matching' with full boolean expressions (AND, OR, NOT, and nested parentheses)|
!!!!!Documentation
&gt; see [[MatchTagsPluginInfo]]
!!!!!Revisions
&lt;&lt;&lt;
2010.03.02 2.0.3 added %6 format (tags)
| please see [[MatchTagsPluginInfo]] for additional revision details |
2008.02.28 1.0.0 initial release
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.MatchTagsPlugin= {major: 2, minor: 0, revision: 3, date: new Date(2010,3,2)};

// store.getMatchingTiddlers() processes boolean expressions for tag matching
//    sortfield (optional) sets sort order for tiddlers - default=title
//    tiddlers (optional) use alternative set of tiddlers (instead of current store)
TiddlyWiki.prototype.getMatchingTiddlers = function(tagexpr,sortfield,tiddlers) {

	var debug=config.options.chkDebug; // abbreviation
	var cmm=config.macros.matchTags; // abbreviation
	var r=[]; // results are an array of tiddlers
	var tids=tiddlers||store.getTiddlers(sortfield||&quot;title&quot;);
	if (tiddlers &amp;&amp; sortfield) store.sortTiddlers(tids,sortfield);
	if (debug) displayMessage(cmm.msg1.format([tids.length]));

	// try simple lookup to quickly find single tags or tags that
	// contain boolean operators as literals, e.g. &quot;foo and bar&quot;
	for (var t=0; t&lt;tids.length; t++)
		if (tids[t].isTagged(tagexpr)) r.pushUnique(tids[t]);
	if (r.length) {
		if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
		return r;
	}
	
	// convert expression into javascript code with regexp tests,
	// so that &quot;tag1 AND ( tag2 OR NOT tag3 )&quot; becomes
	// &quot;/\~tag1\~/.test(...) &amp;&amp; ( /\~tag2\~/.test(...) || ! /\~tag3\~/.test(...) )&quot;

	// normalize whitespace, tokenize operators, delimit with &quot;~&quot;
	var c=tagexpr.trim(); // remove leading/trailing spaces
	c = c.replace(/\s+/ig,&quot; &quot;); // reduce multiple spaces to single spaces
	c = c.replace(/\(\s?/ig,&quot;~(~&quot;); // open parens
	c = c.replace(/\s?\)/ig,&quot;~)~&quot;); // close parens
	c = c.replace(/(\s|~)?&amp;&amp;(\s|~)?/ig,&quot;~&amp;&amp;~&quot;); // &amp;&amp;
	c = c.replace(/(\s|~)AND(\s|~)/ig,&quot;~&amp;&amp;~&quot;); // AND
	c = c.replace(/(\s|~)?\|\|(\s|~)?/ig,&quot;~||~&quot;); // ||
	c = c.replace(/(\s|~)OR(\s|~)/ig,&quot;~||~&quot;); // OR
	c = c.replace(/(\s|~)?!(\s|~)?/ig,&quot;~!~&quot;); // !
	c = c.replace(/(^|~|\s)NOT(\s|~)/ig,&quot;~!~&quot;); // NOT
	c = c.replace(/(^|~|\s)NOT~\(/ig,&quot;~!~(&quot;); // NOT(
	// change tag terms to regexp tests
	var terms=c.split(&quot;~&quot;); for (var i=0; i&lt;terms.length; i++) { var t=terms[i];
		if (/(&amp;&amp;)|(\|\|)|[!\(\)]/.test(t) || t==&quot;&quot;) continue; // skip operators/parens/spaces
		if (t==config.macros.matchTags.untaggedKeyword)
			terms[i]=&quot;tiddlertags=='~~'&quot;; // 'untagged' tiddlers
		else
			terms[i]=&quot;/\\~&quot;+t+&quot;\\~/.test(tiddlertags)&quot;;
	}
	c=terms.join(&quot; &quot;);
	if (debug) { displayMessage(cmm.msg2.format([tagexpr])); displayMessage(cmm.msg3.format([c])); }

	// scan tiddlers for matches
	for (var t=0; t&lt;tids.length; t++) {
	 	// assemble tags from tiddler into string &quot;~tag1~tag2~tag3~&quot;
		var tiddlertags = &quot;~&quot;+tids[t].tags.join(&quot;~&quot;)+&quot;~&quot;;
		try { if(eval(c)) r.push(tids[t]); } // test tags
		catch(e) { // error in test
			displayMessage(cmm.msg2.format([tagexpr]));
			displayMessage(cmm.msg3.format([c]));
			displayMessage(e.toString());
			break; // skip remaining tiddlers
		}
	}
	if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
	return r;
}
//}}}
//{{{
config.macros.matchTags = {
	msg1: &quot;scanning %0 input tiddlers&quot;,
	msg2: &quot;looking for '%0'&quot;,
	msg3: &quot;using expression: '%0'&quot;,
	msg4: &quot;found %0 tiddlers matching '%1'&quot;,
	noMatch: &quot;no matching tiddlers&quot;,
	untaggedKeyword: &quot;-&quot;,
	untaggedLabel: &quot;no tags&quot;,
	untaggedPrompt: &quot;show tiddlers with no tags&quot;,
	defTiddler: &quot;MatchingTiddlers&quot;,
	defTags: &quot;&quot;,
	defFormat: &quot;[[%0]]&quot;,
	defSeparator: &quot;\n&quot;,
	reportHeading: &quot;Found %0 tiddlers tagged with: '{{{%1}}}'\n----\n&quot;,
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var mode=params[0]?params[0].toLowerCase():'';
		if (mode==&quot;inline&quot;)
			params.shift();
		if (mode==&quot;report&quot; || mode==&quot;panel&quot;) {
			params.shift();
			var target=params.shift()||this.defTiddler;
		}
		if (mode==&quot;popup&quot;) {
			params.shift();
			if (params[0]&amp;&amp;params[0].substr(0,6)==&quot;label:&quot;) var label=params.shift().substr(6);
			if (params[0]&amp;&amp;params[0].substr(0,7)==&quot;prompt:&quot;) var prompt=params.shift().substr(7);
		} else {
			var fmt=(params.shift()||this.defFormat).unescapeLineBreaks();
			var sep=(params.shift()||this.defSeparator).unescapeLineBreaks();
		}
		var sortBy=&quot;+title&quot;;
		if (params[0]&amp;&amp;params[0].substr(0,5)==&quot;sort:&quot;) sortBy=params.shift().substr(5);
		var expr = params.join(&quot; &quot;);
		if (mode!=&quot;panel&quot; &amp;&amp; (!expr||!expr.trim().length)) return;
		if (expr==this.untaggedKeyword)
			{ var label=this.untaggedLabel; var prompt=this.untaggedPrompt };
		switch (mode) {
			case &quot;popup&quot;: this.createPopup(place,label,expr,prompt,sortBy); break;
			case &quot;panel&quot;: this.createPanel(place,expr,fmt,sep,sortBy,target); break;
			case &quot;report&quot;: this.createReport(target,this.defTags,expr,fmt,sep,sortBy); break;
			case &quot;inline&quot;: default: this.createInline(place,expr,fmt,sep,sortBy); break;
		}
	},
	formatList: function(tids,fmt,sep) {
		var out=[];
		for (var i=0; i&lt;tids.length; i++) { var t=tids[i];
			var title=t.title;
			var who=t.modifier;
			var when=t.modified.toLocaleString();
			var text=t.text;
			var first=t.text.split(&quot;\n&quot;)[0];
			var desc=store.getTiddlerSlice(t.title,&quot;description&quot;);
			desc=desc||store.getTiddlerSlice(t.title,&quot;Description&quot;);
			desc=desc||store.getTiddlerText(t.title+&quot;##description&quot;);
			desc=desc||store.getTiddlerText(t.title+&quot;##Description&quot;);
			var tags=t.tags.length?'[['+t.tags.join(']] [[')+']]':'';
			out.push(fmt.format([title,who,when,text,first,desc,tags]));
		}
		return out.join(sep);
	},
	createInline: function(place,expr,fmt,sep,sortBy) {
		wikify(this.formatList(store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy),fmt,sep),place);
	},
	createPopup: function(place,label,expr,prompt,sortBy) {
		var btn=createTiddlyButton(place,
			(label||expr).format([expr]),
			(prompt||config.views.wikified.tag.tooltip).format([expr]),
			function(ev){ return config.macros.matchTags.showPopup(this,ev||window.event); });
		btn.setAttribute(&quot;sortBy&quot;,sortBy);
		btn.setAttribute(&quot;expr&quot;,expr);
	},
	showPopup: function(here,ev) {
		var p=Popup.create(here); if (!p) return false;
		var tids=store.getMatchingTiddlers(here.getAttribute(&quot;expr&quot;));
		store.sortTiddlers(tids,here.getAttribute(&quot;sortBy&quot;));
		var list=[]; for (var t=0; t&lt;tids.length; t++) list.push(tids[t].title);
		if (!list.length) createTiddlyText(p,this.noMatch);
		else {
			var b=createTiddlyButton(createTiddlyElement(p,&quot;li&quot;),
				config.views.wikified.tag.openAllText,
				config.views.wikified.tag.openAllTooltip,
				function() {
					var list=this.getAttribute(&quot;list&quot;).readBracketedList();
					story.displayTiddlers(null,tids);
				});
			b.setAttribute(&quot;list&quot;,&quot;[[&quot;+list.join(&quot;]] [[&quot;)+&quot;]]&quot;);
			createTiddlyElement(p,&quot;hr&quot;);
		}
		var out=this.formatList(tids,&quot; &amp;nbsp;[[%0]]&amp;nbsp; &quot;,&quot;\n&quot;); wikify(out,p);
		Popup.show();
		ev.cancelBubble=true;
		if(ev.stopPropagation) ev.stopPropagation();
		return false;
	},
	createReport: function(target,tags,expr,fmt,sep,sortBy) {
		var tids=store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy);
		if (!tids.length) { displayMessage('no matches for: '+expr); return false; }
		var msg=config.messages.overwriteWarning.format([target]);
		if (store.tiddlerExists(target) &amp;&amp; !confirm(msg)) return false;
		var out=this.reportHeading.format([tids.length,expr])
		out+=this.formatList(tids,fmt,sep);
		store.saveTiddler(target,target,out,config.options.txtUserName,new Date(),tags,{});
		story.closeTiddler(target); story.displayTiddler(null,target);
	},
	createPanel: function(place,expr,fmt,sep,sortBy,tid) {
		var s=createTiddlyElement(place,&quot;span&quot;); s.innerHTML=store.getTiddlerText(&quot;MatchTagsPlugin##html&quot;);
		var f=s.getElementsByTagName(&quot;form&quot;)[0];
		f.expr.value=expr; f.fmt.value=fmt; f.sep.value=sep.escapeLineBreaks();
		f.tid.value=tid; f.tags.value=this.defTags;
	}
};
//}}}
/***
//{{{
!html
&lt;form style='display:inline;white-space:nowrap'&gt;
&lt;input type='text'    name='expr' style='width:50%' title='tag expression'&gt;&lt;!--
--&gt;&lt;input type='text'    name='fmt'  style='width:10%' title='list item format'&gt;&lt;!--
--&gt;&lt;input type='text'    name='sep'  style='width:5%'  title='list item separator'&gt;&lt;!--
--&gt;&lt;input type='text'    name='tid'  style='width:12%' title='target tiddler title'&gt;&lt;!--
--&gt;&lt;input type='text'    name='tags' style='width:10%' title='target tiddler tags'&gt;&lt;!--
--&gt;&lt;input type='button'  name='go'   style='width:8%'  value='go' onclick=&quot;
	var expr=this.form.expr.value;
	if (!expr.length) { alert('Enter a boolean tag expression'); return false; }
	var fmt=this.form.fmt.value;
	if (!fmt.length) { alert('Enter the list item output format'); return false; }
	var sep=this.form.sep.value.unescapeLineBreaks();
	var tid=this.form.tid.value;
	if (!tid.length) { alert('Enter a target tiddler title'); return false; }
	var tags=this.form.tags.value;
	config.macros.matchTags.createReport(tid,tags,expr,fmt,sep,'title');
	return false;&quot;&gt;
&lt;/form&gt;
!end
//}}}
***/
//{{{
// SHADOW TIDDLER for displaying default panel input form
config.shadowTiddlers.MatchTags=&quot;&lt;&lt;matchTags panel&gt;&gt;&quot;;
//}}}
//{{{
// TWEAK core filterTiddlers() for enhanced boolean matching in [tag[...]] syntax:
// use getMatchingTiddlers instead getTaggedTiddlers
var fn=TiddlyWiki.prototype.filterTiddlers;
fn=fn.toString().replace(/getTaggedTiddlers/g,&quot;getMatchingTiddlers&quot;);
eval(&quot;TiddlyWiki.prototype.filterTiddlers=&quot;+fn);
//}}}
//{{{
// REDEFINE core handler for enhanced boolean matching in tag:&quot;...&quot; paramifier
// use filterTiddlers() instead of getTaggedTiddlers() to get list of tiddlers.
config.paramifiers.tag = {
	onstart: function(v) {
		var tagged = store.filterTiddlers(&quot;[tag[&quot;+v+&quot;]]&quot;);
		story.displayTiddlers(null,tagged,null,false,null);
	}
};
//}}}</pre>
</div>
<div title="MathSVG Plugin" modifier="escdie" created="201102161939" modified="201102211617" tags="%tw-elnb plugin systemConfig">
<pre>/***
|''Name:''|MathSVGPlugin|
|''Description:''|This plugin translates a subset of the LaTeX math notation to MathML with a customisable  image fallback when MathML is not supported. It also provides an easy way to produce mathematical SVG graphics with dynamical features and animation.|
|''Version:''|1.4.3|
|''Date:''|2010-10-20|
|''Source:''|http://www.math.ist.utl.pt/~psoares/MathSVG.html|
|''Author:''|Paulo Soares|
|''License:''|[[GNU Lesser General Public License|http://www.gnu.org/licences/lgpl.html]]|
|''~CoreVersion:''|2.5.0|
!Original copyright notice
{{{
ASCIIMathML.js
==============
Version 2.1 Oct 8, 2008, (c) Peter Jipsen http://www.chapman.edu/~jipsen
This version extends ASCIIMathML.js with LaTeXMathML.js and ASCIIsvg.js.
Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
If you use it on a webpage, please send the URL to jipsen@chapman.edu

The LaTeXMathML modifications were made by Douglas Woodall, June 2006.
(for details see header on the LaTeXMathML part in middle of file)
Extensive clean-up and improvements by Paulo Soares, Oct 2007.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
(at http://www.gnu.org/licences/lgpl.html) for more details.
}}}
!~MathSVG code (minified)
***/
//{{{
Math.sec=function(a){return 1/Math.cos(a)};Math.csc=function(a){return 1/Math.sin(a)};Math.cot=function(a){return 1/Math.tan(a)};Math.asec=function(a){return Math.acos(1/a)};Math.acsc=function(a){return Math.asin(1/a)};Math.acot=function(a){return Math.atan(1/a)};Math.sinh=function(a){return(Math.exp(a)-Math.exp(-a))/2};Math.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};Math.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};Math.sech=function(a){return 1/Math.cosh(a)};Math.csch=function(a){return 1/Math.sinh(a)};Math.coth=function(a){return 1/Math.tanh(a)};Math.asinh=function(a){return Math.log(a+Math.sqrt(a*a+1))};Math.acosh=function(a){return Math.log(a+Math.sqrt(a*a-1))};Math.atanh=function(a){return Math.log((1+a)/(1-a))/2};Math.sech=function(a){return 1/Math.cosh(a)};Math.csch=function(a){return 1/Math.sinh(a)};Math.coth=function(a){return 1/Math.tanh(a)};Math.asech=function(a){return Math.acosh(1/a)};Math.acsch=function(a){return Math.asinh(1/a)};Math.acoth=function(a){return Math.atanh(1/a)};Math.sign=function(a){return(a===0?0:(a&lt;0?-1:1))};Math.step=function(a,c,b){return(a&lt;0?(b?b:0):(c?c:1))};Math.root=function(a,b){return Math.pow(a,1/b)};Math.factorial=function(b){if(b===0){return 1}if(b&lt;0){if((b%1)===0){return}if(b&gt;-1){return Math.factorial(b+1)/(b+1)}return -Math.PI/(Math.factorial(-1-b)*Math.sin(Math.PI*b))}var a=b;if((b%1)===0){while(b&gt;1){b=b-1;a=a*b}}else{a=Math.exp((b+0.5)*Math.log(b+1)-b-b*(0.1121105+b*0.08106103)/(1.452342+b*(2.410858+b)))}return a};Math.Gamma=function(a){return Math.factorial(a-1)};Math.Beta=function(a,b){return Math.Gamma(a)*Math.Gamma(b)/Math.Gamma(a+b)};Math.C=function(a,b){var c=1/((a+1)*Math.Beta(b+1,a-b+1));return c};Math.truncate=function(a,c){var b=c||0;return Math.floor(a*Math.pow(10,b))/Math.pow(10,b)};Math.randomString=function(a,g){var f=(g||&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&quot;).split(&quot;&quot;);var e=[],c=Math.random;var d=f.length;for(var b=0;b&lt;a;b++){e[b]=f[0|c()*d]}return e.join(&quot;&quot;)};Math.runif=function(d,c,f){var e=f||0;return Math.truncate((c+Math.pow(10,-e)-d)*Math.random()+d,e)};Math.rnormal=function(a,b){a=a||0;b=b||1;var d=0,c=0;while(d*c===0){d=Math.random();c=Math.random()}return b*(Math.sqrt(-2*Math.log(d))*Math.cos(2*Math.PI*c))+a};(function(){var a=jQuery.fn.attr,b=&quot;http://www.w3.org/2000/svg&quot;;jQuery.fn.attr=function(m,l){var g=this.length;if(!g){return this}for(var f=0;f&lt;g;f++){var c=this[f];if(c.namespaceURI===b){if(l!==undefined){c.setAttribute(m,l)}else{if($.isArray(m)){var d=m.length,e={};while(d--){var k=m[d];var h=c.getAttribute(k);if(h||h===&quot;0&quot;){h=isNaN(h)?h:h-0}e[k]=h}return e}else{if(typeof m===&quot;object&quot;){for(v in m){c.setAttribute(v,m[v])}}else{var h=c.getAttribute(m);if(h||h===&quot;0&quot;){h=isNaN(h)?h:h-0}return h}}}}else{return a.apply(this,arguments)}}return this}}());var MSVG=function($){var cal=[&quot;\uD835\uDC9C&quot;,&quot;\u212C&quot;,&quot;\uD835\uDC9E&quot;,&quot;\uD835\uDC9F&quot;,&quot;\u2130&quot;,&quot;\u2131&quot;,&quot;\uD835\uDCA2&quot;,&quot;\u210B&quot;,&quot;\u2110&quot;,&quot;\uD835\uDCA5&quot;,&quot;\uD835\uDCA6&quot;,&quot;\u2112&quot;,&quot;\u2133&quot;,&quot;\uD835\uDCA9&quot;,&quot;\uD835\uDCAA&quot;,&quot;\uD835\uDCAB&quot;,&quot;\uD835\uDCAC&quot;,&quot;\u211B&quot;,&quot;\uD835\uDCAE&quot;,&quot;\uD835\uDCAF&quot;,&quot;\uD835\uDCB0&quot;,&quot;\uD835\uDCB1&quot;,&quot;\uD835\uDCB2&quot;,&quot;\uD835\uDCB3&quot;,&quot;\uD835\uDCB4&quot;,&quot;\uD835\uDCB5&quot;,&quot;\uD835\uDCB6&quot;,&quot;\uD835\uDCB7&quot;,&quot;\uD835\uDCB8&quot;,&quot;\uD835\uDCB9&quot;,&quot;\u212F&quot;,&quot;\uD835\uDCBB&quot;,&quot;\u210A&quot;,&quot;\uD835\uDCBD&quot;,&quot;\uD835\uDCBE&quot;,&quot;\uD835\uDCBF&quot;,&quot;\uD835\uDCC0&quot;,&quot;\uD835\uDCC1&quot;,&quot;\uD835\uDCC2&quot;,&quot;\uD835\uDCC3&quot;,&quot;\u2134&quot;,&quot;\uD835\uDCC5&quot;,&quot;\uD835\uDCC6&quot;,&quot;\uD835\uDCC7&quot;,&quot;\uD835\uDCC8&quot;,&quot;\uD835\uDCC9&quot;,&quot;\uD835\uDCCA&quot;,&quot;\uD835\uDCCB&quot;,&quot;\uD835\uDCCC&quot;,&quot;\uD835\uDCCD&quot;,&quot;\uD835\uDCCE&quot;,&quot;\uD835\uDCCF&quot;];var frk=[&quot;\uD835\uDD04&quot;,&quot;\uD835\uDD05&quot;,&quot;\u212D&quot;,&quot;\uD835\uDD07&quot;,&quot;\uD835\uDD08&quot;,&quot;\uD835\uDD09&quot;,&quot;\uD835\uDD0A&quot;,&quot;\u210C&quot;,&quot;\u2111&quot;,&quot;\uD835\uDD0D&quot;,&quot;\uD835\uDD0E&quot;,&quot;\uD835\uDD0F&quot;,&quot;\uD835\uDD10&quot;,&quot;\uD835\uDD11&quot;,&quot;\uD835\uDD12&quot;,&quot;\uD835\uDD13&quot;,&quot;\uD835\uDD14&quot;,&quot;\u211C&quot;,&quot;\uD835\uDD16&quot;,&quot;\uD835\uDD17&quot;,&quot;\uD835\uDD18&quot;,&quot;\uD835\uDD19&quot;,&quot;\uD835\uDD1A&quot;,&quot;\uD835\uDD1B&quot;,&quot;\uD835\uDD1C&quot;,&quot;\u2128&quot;,&quot;\uD835\uDD1E&quot;,&quot;\uD835\uDD1F&quot;,&quot;\uD835\uDD20&quot;,&quot;\uD835\uDD21&quot;,&quot;\uD835\uDD22&quot;,&quot;\uD835\uDD23&quot;,&quot;\uD835\uDD24&quot;,&quot;\uD835\uDD25&quot;,&quot;\uD835\uDD26&quot;,&quot;\uD835\uDD27&quot;,&quot;\uD835\uDD28&quot;,&quot;\uD835\uDD29&quot;,&quot;\uD835\uDD2A&quot;,&quot;\uD835\uDD2B&quot;,&quot;\uD835\uDD2C&quot;,&quot;\uD835\uDD2D&quot;,&quot;\uD835\uDD2E&quot;,&quot;\uD835\uDD2F&quot;,&quot;\uD835\uDD30&quot;,&quot;\uD835\uDD31&quot;,&quot;\uD835\uDD32&quot;,&quot;\uD835\uDD33&quot;,&quot;\uD835\uDD34&quot;,&quot;\uD835\uDD35&quot;,&quot;\uD835\uDD36&quot;,&quot;\uD835\uDD37&quot;];var bbb=[&quot;\uD835\uDD38&quot;,&quot;\uD835\uDD39&quot;,&quot;\u2102&quot;,&quot;\uD835\uDD3B&quot;,&quot;\uD835\uDD3C&quot;,&quot;\uD835\uDD3D&quot;,&quot;\uD835\uDD3E&quot;,&quot;\u210D&quot;,&quot;\uD835\uDD40&quot;,&quot;\uD835\uDD41&quot;,&quot;\uD835\uDD42&quot;,&quot;\uD835\uDD43&quot;,&quot;\uD835\uDD44&quot;,&quot;\u2115&quot;,&quot;\uD835\uDD46&quot;,&quot;\u2119&quot;,&quot;\u211A&quot;,&quot;\u211D&quot;,&quot;\uD835\uDD4A&quot;,&quot;\uD835\uDD4B&quot;,&quot;\uD835\uDD4C&quot;,&quot;\uD835\uDD4D&quot;,&quot;\uD835\uDD4E&quot;,&quot;\uD835\uDD4F&quot;,&quot;\uD835\uDD50&quot;,&quot;\u2124&quot;,&quot;\uD835\uDD52&quot;,&quot;\uD835\uDD53&quot;,&quot;\uD835\uDD54&quot;,&quot;\uD835\uDD55&quot;,&quot;\uD835\uDD56&quot;,&quot;\uD835\uDD57&quot;,&quot;\uD835\uDD58&quot;,&quot;\uD835\uDD59&quot;,&quot;\uD835\uDD5A&quot;,&quot;\uD835\uDD5B&quot;,&quot;\uD835\uDD5C&quot;,&quot;\uD835\uDD5D&quot;,&quot;\uD835\uDD5E&quot;,&quot;\uD835\uDD5F&quot;,&quot;\uD835\uDD60&quot;,&quot;\uD835\uDD61&quot;,&quot;\uD835\uDD62&quot;,&quot;\uD835\uDD63&quot;,&quot;\uD835\uDD64&quot;,&quot;\uD835\uDD65&quot;,&quot;\uD835\uDD66&quot;,&quot;\uD835\uDD67&quot;,&quot;\uD835\uDD68&quot;,&quot;\uD835\uDD69&quot;,&quot;\uD835\uDD6A&quot;,&quot;\uD835\uDD6B&quot;];var CONST=0,UNARY=1,BINARY=2,INFIX=3,LEFTBRACKET=4,RIGHTBRACKET=5,SPACE=6,UNDEROVER=7,DEFINITION=8,LEFTRIGHT=9,TEXT=10,BIG=11,STRETCHY=13,MATRIX=14;var symbols=[{input:&quot;\\varepsilon&quot;,tag:&quot;mi&quot;,output:&quot;\u025B&quot;,ttype:CONST},{input:&quot;\\varsigma&quot;,tag:&quot;mi&quot;,output:&quot;\u03C2&quot;,ttype:CONST},{input:&quot;\\vartheta&quot;,tag:&quot;mi&quot;,output:&quot;\u03D1&quot;,ttype:CONST},{input:&quot;\\varphi&quot;,tag:&quot;mi&quot;,output:&quot;\u03D5&quot;,ttype:CONST},{input:&quot;\\varpi&quot;,tag:&quot;mi&quot;,output:&quot;\u03D6&quot;,ttype:CONST},{input:&quot;\\varrho&quot;,tag:&quot;mi&quot;,output:&quot;\u03F1&quot;,ttype:CONST},{input:&quot;\\alpha&quot;,tag:&quot;mi&quot;,output:&quot;\u03B1&quot;,ttype:CONST},{input:&quot;\\beta&quot;,tag:&quot;mi&quot;,output:&quot;\u03B2&quot;,ttype:CONST},{input:&quot;\\gamma&quot;,tag:&quot;mi&quot;,output:&quot;\u03B3&quot;,ttype:CONST},{input:&quot;\\delta&quot;,tag:&quot;mi&quot;,output:&quot;\u03B4&quot;,ttype:CONST},{input:&quot;\\epsilon&quot;,tag:&quot;mi&quot;,output:&quot;\u03B5&quot;,ttype:CONST},{input:&quot;\\zeta&quot;,tag:&quot;mi&quot;,output:&quot;\u03B6&quot;,ttype:CONST},{input:&quot;\\eta&quot;,tag:&quot;mi&quot;,output:&quot;\u03B7&quot;,ttype:CONST},{input:&quot;\\theta&quot;,tag:&quot;mi&quot;,output:&quot;\u03B8&quot;,ttype:CONST},{input:&quot;\\iota&quot;,tag:&quot;mi&quot;,output:&quot;\u03B9&quot;,ttype:CONST},{input:&quot;\\kappa&quot;,tag:&quot;mi&quot;,output:&quot;\u03BA&quot;,ttype:CONST},{input:&quot;\\lambda&quot;,tag:&quot;mi&quot;,output:&quot;\u03BB&quot;,ttype:CONST},{input:&quot;\\mu&quot;,tag:&quot;mi&quot;,output:&quot;\u03BC&quot;,ttype:CONST},{input:&quot;\\nu&quot;,tag:&quot;mi&quot;,output:&quot;\u03BD&quot;,ttype:CONST},{input:&quot;\\xi&quot;,tag:&quot;mi&quot;,output:&quot;\u03BE&quot;,ttype:CONST},{input:&quot;\\omicron&quot;,tag:&quot;mi&quot;,output:&quot;\u03BF&quot;,ttype:CONST},{input:&quot;\\pi&quot;,tag:&quot;mi&quot;,output:&quot;\u03C0&quot;,ttype:CONST},{input:&quot;\\rho&quot;,tag:&quot;mi&quot;,output:&quot;\u03C1&quot;,ttype:CONST},{input:&quot;\\sigma&quot;,tag:&quot;mi&quot;,output:&quot;\u03C3&quot;,ttype:CONST},{input:&quot;\\tau&quot;,tag:&quot;mi&quot;,output:&quot;\u03C4&quot;,ttype:CONST},{input:&quot;\\upsilon&quot;,tag:&quot;mi&quot;,output:&quot;\u03C5&quot;,ttype:CONST},{input:&quot;\\phi&quot;,tag:&quot;mi&quot;,output:&quot;\u03C6&quot;,ttype:CONST},{input:&quot;\\chi&quot;,tag:&quot;mi&quot;,output:&quot;\u03C7&quot;,ttype:CONST},{input:&quot;\\psi&quot;,tag:&quot;mi&quot;,output:&quot;\u03C8&quot;,ttype:CONST},{input:&quot;\\omega&quot;,tag:&quot;mi&quot;,output:&quot;\u03C9&quot;,ttype:CONST},{input:&quot;\\Alpha&quot;,tag:&quot;mo&quot;,output:&quot;\u0391&quot;,ttype:CONST},{input:&quot;\\Beta&quot;,tag:&quot;mo&quot;,output:&quot;\u0392&quot;,ttype:CONST},{input:&quot;\\Gamma&quot;,tag:&quot;mo&quot;,output:&quot;\u0393&quot;,ttype:CONST},{input:&quot;\\Delta&quot;,tag:&quot;mo&quot;,output:&quot;\u0394&quot;,ttype:CONST},{input:&quot;\\Epsilon&quot;,tag:&quot;mo&quot;,output:&quot;\u0395&quot;,ttype:CONST},{input:&quot;\\Zeta&quot;,tag:&quot;mo&quot;,output:&quot;\u0396&quot;,ttype:CONST},{input:&quot;\\Eta&quot;,tag:&quot;mo&quot;,output:&quot;\u0397&quot;,ttype:CONST},{input:&quot;\\Theta&quot;,tag:&quot;mo&quot;,output:&quot;\u0398&quot;,ttype:CONST},{input:&quot;\\Iota&quot;,tag:&quot;mo&quot;,output:&quot;\u0399&quot;,ttype:CONST},{input:&quot;\\Kappa&quot;,tag:&quot;mo&quot;,output:&quot;\u039A&quot;,ttype:CONST},{input:&quot;\\Lambda&quot;,tag:&quot;mo&quot;,output:&quot;\u039B&quot;,ttype:CONST},{input:&quot;\\Mu&quot;,tag:&quot;mo&quot;,output:&quot;\u039C&quot;,ttype:CONST},{input:&quot;\\Nu&quot;,tag:&quot;mo&quot;,output:&quot;\u039D&quot;,ttype:CONST},{input:&quot;\\Xi&quot;,tag:&quot;mo&quot;,output:&quot;\u039E&quot;,ttype:CONST},{input:&quot;\\Omicron&quot;,tag:&quot;mo&quot;,output:&quot;\u039F&quot;,ttype:CONST},{input:&quot;\\Pi&quot;,tag:&quot;mo&quot;,output:&quot;\u03A0&quot;,ttype:CONST},{input:&quot;\\Rho&quot;,tag:&quot;mo&quot;,output:&quot;\u03A1&quot;,ttype:CONST},{input:&quot;\\Sigma&quot;,tag:&quot;mo&quot;,output:&quot;\u03A3&quot;,ttype:CONST},{input:&quot;\\Tau&quot;,tag:&quot;mo&quot;,output:&quot;\u03A4&quot;,ttype:CONST},{input:&quot;\\Upsilon&quot;,tag:&quot;mo&quot;,output:&quot;\u03A5&quot;,ttype:CONST},{input:&quot;\\Phi&quot;,tag:&quot;mo&quot;,output:&quot;\u03A6&quot;,ttype:CONST},{input:&quot;\\Chi&quot;,tag:&quot;mo&quot;,output:&quot;\u03A7&quot;,ttype:CONST},{input:&quot;\\Psi&quot;,tag:&quot;mo&quot;,output:&quot;\u03A8&quot;,ttype:CONST},{input:&quot;\\Omega&quot;,tag:&quot;mo&quot;,output:&quot;\u03A9&quot;,ttype:CONST},{input:&quot;\\frac12&quot;,tag:&quot;mo&quot;,output:&quot;\u00BD&quot;,ttype:CONST},{input:&quot;\\frac14&quot;,tag:&quot;mo&quot;,output:&quot;\u00BC&quot;,ttype:CONST},{input:&quot;\\frac34&quot;,tag:&quot;mo&quot;,output:&quot;\u00BE&quot;,ttype:CONST},{input:&quot;\\frac13&quot;,tag:&quot;mo&quot;,output:&quot;\u2153&quot;,ttype:CONST},{input:&quot;\\frac23&quot;,tag:&quot;mo&quot;,output:&quot;\u2154&quot;,ttype:CONST},{input:&quot;\\frac15&quot;,tag:&quot;mo&quot;,output:&quot;\u2155&quot;,ttype:CONST},{input:&quot;\\frac25&quot;,tag:&quot;mo&quot;,output:&quot;\u2156&quot;,ttype:CONST},{input:&quot;\\frac35&quot;,tag:&quot;mo&quot;,output:&quot;\u2157&quot;,ttype:CONST},{input:&quot;\\frac45&quot;,tag:&quot;mo&quot;,output:&quot;\u2158&quot;,ttype:CONST},{input:&quot;\\frac16&quot;,tag:&quot;mo&quot;,output:&quot;\u2159&quot;,ttype:CONST},{input:&quot;\\frac56&quot;,tag:&quot;mo&quot;,output:&quot;\u215A&quot;,ttype:CONST},{input:&quot;\\frac18&quot;,tag:&quot;mo&quot;,output:&quot;\u215B&quot;,ttype:CONST},{input:&quot;\\frac38&quot;,tag:&quot;mo&quot;,output:&quot;\u215C&quot;,ttype:CONST},{input:&quot;\\frac58&quot;,tag:&quot;mo&quot;,output:&quot;\u215D&quot;,ttype:CONST},{input:&quot;\\frac78&quot;,tag:&quot;mo&quot;,output:&quot;\u215E&quot;,ttype:CONST},{input:&quot;\\pm&quot;,tag:&quot;mo&quot;,output:&quot;\u00B1&quot;,ttype:CONST},{input:&quot;\\mp&quot;,tag:&quot;mo&quot;,output:&quot;\u2213&quot;,ttype:CONST},{input:&quot;\\triangleleft&quot;,tag:&quot;mo&quot;,output:&quot;\u22B2&quot;,ttype:CONST},{input:&quot;\\triangleright&quot;,tag:&quot;mo&quot;,output:&quot;\u22B3&quot;,ttype:CONST},{input:&quot;\\cdot&quot;,tag:&quot;mo&quot;,output:&quot;\u22C5&quot;,ttype:CONST},{input:&quot;\\star&quot;,tag:&quot;mo&quot;,output:&quot;\u22C6&quot;,ttype:CONST},{input:&quot;\\ast&quot;,tag:&quot;mo&quot;,output:&quot;\u002A&quot;,ttype:CONST},{input:&quot;\\times&quot;,tag:&quot;mo&quot;,output:&quot;\u00D7&quot;,ttype:CONST},{input:&quot;\\div&quot;,tag:&quot;mo&quot;,output:&quot;\u00F7&quot;,ttype:CONST},{input:&quot;\\circ&quot;,tag:&quot;mo&quot;,output:&quot;\u2218&quot;,ttype:CONST},{input:&quot;\\bullet&quot;,tag:&quot;mo&quot;,output:&quot;\u2022&quot;,ttype:CONST},{input:&quot;\\oplus&quot;,tag:&quot;mo&quot;,output:&quot;\u2295&quot;,ttype:CONST},{input:&quot;\\ominus&quot;,tag:&quot;mo&quot;,output:&quot;\u2296&quot;,ttype:CONST},{input:&quot;\\otimes&quot;,tag:&quot;mo&quot;,output:&quot;\u2297&quot;,ttype:CONST},{input:&quot;\\bigcirc&quot;,tag:&quot;mo&quot;,output:&quot;\u25CB&quot;,ttype:CONST},{input:&quot;\\oslash&quot;,tag:&quot;mo&quot;,output:&quot;\u2298&quot;,ttype:CONST},{input:&quot;\\odot&quot;,tag:&quot;mo&quot;,output:&quot;\u2299&quot;,ttype:CONST},{input:&quot;\\land&quot;,tag:&quot;mo&quot;,output:&quot;\u2227&quot;,ttype:CONST},{input:&quot;\\wedge&quot;,tag:&quot;mo&quot;,output:&quot;\u2227&quot;,ttype:CONST},{input:&quot;\\lor&quot;,tag:&quot;mo&quot;,output:&quot;\u2228&quot;,ttype:CONST},{input:&quot;\\vee&quot;,tag:&quot;mo&quot;,output:&quot;\u2228&quot;,ttype:CONST},{input:&quot;\\cap&quot;,tag:&quot;mo&quot;,output:&quot;\u2229&quot;,ttype:CONST},{input:&quot;\\cup&quot;,tag:&quot;mo&quot;,output:&quot;\u222A&quot;,ttype:CONST},{input:&quot;\\sqcap&quot;,tag:&quot;mo&quot;,output:&quot;\u2293&quot;,ttype:CONST},{input:&quot;\\sqcup&quot;,tag:&quot;mo&quot;,output:&quot;\u2294&quot;,ttype:CONST},{input:&quot;\\uplus&quot;,tag:&quot;mo&quot;,output:&quot;\u228E&quot;,ttype:CONST},{input:&quot;\\amalg&quot;,tag:&quot;mo&quot;,output:&quot;\u2210&quot;,ttype:CONST},{input:&quot;\\bigtriangleup&quot;,tag:&quot;mo&quot;,output:&quot;\u25B3&quot;,ttype:CONST},{input:&quot;\\bigtriangledown&quot;,tag:&quot;mo&quot;,output:&quot;\u25BD&quot;,ttype:CONST},{input:&quot;\\dag&quot;,tag:&quot;mo&quot;,output:&quot;\u2020&quot;,ttype:CONST},{input:&quot;\\dagger&quot;,tag:&quot;mo&quot;,output:&quot;\u2020&quot;,ttype:CONST},{input:&quot;\\ddag&quot;,tag:&quot;mo&quot;,output:&quot;\u2021&quot;,ttype:CONST},{input:&quot;\\ddagger&quot;,tag:&quot;mo&quot;,output:&quot;\u2021&quot;,ttype:CONST},{input:&quot;\\lhd&quot;,tag:&quot;mo&quot;,output:&quot;\u22B2&quot;,ttype:CONST},{input:&quot;\\rhd&quot;,tag:&quot;mo&quot;,output:&quot;\u22B3&quot;,ttype:CONST},{input:&quot;\\unlhd&quot;,tag:&quot;mo&quot;,output:&quot;\u22B4&quot;,ttype:CONST},{input:&quot;\\unrhd&quot;,tag:&quot;mo&quot;,output:&quot;\u22B5&quot;,ttype:CONST},{input:&quot;\\sum&quot;,tag:&quot;mo&quot;,output:&quot;\u2211&quot;,ttype:UNDEROVER},{input:&quot;\\prod&quot;,tag:&quot;mo&quot;,output:&quot;\u220F&quot;,ttype:UNDEROVER},{input:&quot;\\bigcap&quot;,tag:&quot;mo&quot;,output:&quot;\u22C2&quot;,ttype:UNDEROVER},{input:&quot;\\bigcup&quot;,tag:&quot;mo&quot;,output:&quot;\u22C3&quot;,ttype:UNDEROVER},{input:&quot;\\bigwedge&quot;,tag:&quot;mo&quot;,output:&quot;\u22C0&quot;,ttype:UNDEROVER},{input:&quot;\\bigvee&quot;,tag:&quot;mo&quot;,output:&quot;\u22C1&quot;,ttype:UNDEROVER},{input:&quot;\\bigsqcap&quot;,tag:&quot;mo&quot;,output:&quot;\u2A05&quot;,ttype:UNDEROVER},{input:&quot;\\bigsqcup&quot;,tag:&quot;mo&quot;,output:&quot;\u2A06&quot;,ttype:UNDEROVER},{input:&quot;\\coprod&quot;,tag:&quot;mo&quot;,output:&quot;\u2210&quot;,ttype:UNDEROVER},{input:&quot;\\bigoplus&quot;,tag:&quot;mo&quot;,output:&quot;\u2A01&quot;,ttype:UNDEROVER},{input:&quot;\\bigotimes&quot;,tag:&quot;mo&quot;,output:&quot;\u2A02&quot;,ttype:UNDEROVER},{input:&quot;\\bigodot&quot;,tag:&quot;mo&quot;,output:&quot;\u2A00&quot;,ttype:UNDEROVER},{input:&quot;\\biguplus&quot;,tag:&quot;mo&quot;,output:&quot;\u2A04&quot;,ttype:UNDEROVER},{input:&quot;\\int&quot;,tag:&quot;mo&quot;,output:&quot;\u222B&quot;,ttype:CONST},{input:&quot;\\oint&quot;,tag:&quot;mo&quot;,output:&quot;\u222E&quot;,ttype:CONST},{input:&quot;:=&quot;,tag:&quot;mo&quot;,output:&quot;:=&quot;,ttype:CONST},{input:&quot;\\lt&quot;,tag:&quot;mo&quot;,output:&quot;&lt;&quot;,ttype:CONST},{input:&quot;\\gt&quot;,tag:&quot;mo&quot;,output:&quot;&gt;&quot;,ttype:CONST},{input:&quot;\\ne&quot;,tag:&quot;mo&quot;,output:&quot;\u2260&quot;,ttype:CONST},{input:&quot;\\neq&quot;,tag:&quot;mo&quot;,output:&quot;\u2260&quot;,ttype:CONST},{input:&quot;\\le&quot;,tag:&quot;mo&quot;,output:&quot;\u2264&quot;,ttype:CONST},{input:&quot;\\leq&quot;,tag:&quot;mo&quot;,output:&quot;\u2264&quot;,ttype:CONST},{input:&quot;\\leqslant&quot;,tag:&quot;mo&quot;,output:&quot;\u2264&quot;,ttype:CONST},{input:&quot;\\ge&quot;,tag:&quot;mo&quot;,output:&quot;\u2265&quot;,ttype:CONST},{input:&quot;\\geq&quot;,tag:&quot;mo&quot;,output:&quot;\u2265&quot;,ttype:CONST},{input:&quot;\\geqslant&quot;,tag:&quot;mo&quot;,output:&quot;\u2265&quot;,ttype:CONST},{input:&quot;\\equiv&quot;,tag:&quot;mo&quot;,output:&quot;\u2261&quot;,ttype:CONST},{input:&quot;\\ll&quot;,tag:&quot;mo&quot;,output:&quot;\u226A&quot;,ttype:CONST},{input:&quot;\\gg&quot;,tag:&quot;mo&quot;,output:&quot;\u226B&quot;,ttype:CONST},{input:&quot;\\doteq&quot;,tag:&quot;mo&quot;,output:&quot;\u2250&quot;,ttype:CONST},{input:&quot;\\prec&quot;,tag:&quot;mo&quot;,output:&quot;\u227A&quot;,ttype:CONST},{input:&quot;\\succ&quot;,tag:&quot;mo&quot;,output:&quot;\u227B&quot;,ttype:CONST},{input:&quot;\\preceq&quot;,tag:&quot;mo&quot;,output:&quot;\u227C&quot;,ttype:CONST},{input:&quot;\\succeq&quot;,tag:&quot;mo&quot;,output:&quot;\u227D&quot;,ttype:CONST},{input:&quot;\\subset&quot;,tag:&quot;mo&quot;,output:&quot;\u2282&quot;,ttype:CONST},{input:&quot;\\supset&quot;,tag:&quot;mo&quot;,output:&quot;\u2283&quot;,ttype:CONST},{input:&quot;\\subseteq&quot;,tag:&quot;mo&quot;,output:&quot;\u2286&quot;,ttype:CONST},{input:&quot;\\supseteq&quot;,tag:&quot;mo&quot;,output:&quot;\u2287&quot;,ttype:CONST},{input:&quot;\\sqsubset&quot;,tag:&quot;mo&quot;,output:&quot;\u228F&quot;,ttype:CONST},{input:&quot;\\sqsupset&quot;,tag:&quot;mo&quot;,output:&quot;\u2290&quot;,ttype:CONST},{input:&quot;\\sqsubseteq&quot;,tag:&quot;mo&quot;,output:&quot;\u2291&quot;,ttype:CONST},{input:&quot;\\sqsupseteq&quot;,tag:&quot;mo&quot;,output:&quot;\u2292&quot;,ttype:CONST},{input:&quot;\\sim&quot;,tag:&quot;mo&quot;,output:&quot;\u223C&quot;,ttype:CONST},{input:&quot;\\simeq&quot;,tag:&quot;mo&quot;,output:&quot;\u2243&quot;,ttype:CONST},{input:&quot;\\approx&quot;,tag:&quot;mo&quot;,output:&quot;\u2248&quot;,ttype:CONST},{input:&quot;\\cong&quot;,tag:&quot;mo&quot;,output:&quot;\u2245&quot;,ttype:CONST},{input:&quot;\\Join&quot;,tag:&quot;mo&quot;,output:&quot;\u22C8&quot;,ttype:CONST},{input:&quot;\\bowtie&quot;,tag:&quot;mo&quot;,output:&quot;\u22C8&quot;,ttype:CONST},{input:&quot;\\in&quot;,tag:&quot;mo&quot;,output:&quot;\u2208&quot;,ttype:CONST},{input:&quot;\\ni&quot;,tag:&quot;mo&quot;,output:&quot;\u220B&quot;,ttype:CONST},{input:&quot;\\owns&quot;,tag:&quot;mo&quot;,output:&quot;\u220B&quot;,ttype:CONST},{input:&quot;\\propto&quot;,tag:&quot;mo&quot;,output:&quot;\u221D&quot;,ttype:CONST},{input:&quot;\\vdash&quot;,tag:&quot;mo&quot;,output:&quot;\u22A2&quot;,ttype:CONST},{input:&quot;\\dashv&quot;,tag:&quot;mo&quot;,output:&quot;\u22A3&quot;,ttype:CONST},{input:&quot;\\models&quot;,tag:&quot;mo&quot;,output:&quot;\u22A8&quot;,ttype:CONST},{input:&quot;\\perp&quot;,tag:&quot;mo&quot;,output:&quot;\u22A5&quot;,ttype:CONST},{input:&quot;\\smile&quot;,tag:&quot;mo&quot;,output:&quot;\u2323&quot;,ttype:CONST},{input:&quot;\\frown&quot;,tag:&quot;mo&quot;,output:&quot;\u2322&quot;,ttype:CONST},{input:&quot;\\asymp&quot;,tag:&quot;mo&quot;,output:&quot;\u224D&quot;,ttype:CONST},{input:&quot;\\notin&quot;,tag:&quot;mo&quot;,output:&quot;\u2209&quot;,ttype:CONST},{input:&quot;\\begin{eqnarray}&quot;,output:&quot;X&quot;,ttype:MATRIX,invisible:true},{input:&quot;\\begin{array}&quot;,output:&quot;X&quot;,ttype:MATRIX,invisible:true},{input:&quot;\\\\&quot;,output:&quot;}&amp;{&quot;,ttype:DEFINITION},{input:&quot;\\end{eqnarray}&quot;,output:&quot;}}&quot;,ttype:DEFINITION},{input:&quot;\\end{array}&quot;,output:&quot;}}&quot;,ttype:DEFINITION},{input:&quot;\\big&quot;,tag:&quot;mo&quot;,output:&quot;X&quot;,atval:&quot;1.2&quot;,ttype:BIG},{input:&quot;\\Big&quot;,tag:&quot;mo&quot;,output:&quot;X&quot;,atval:&quot;1.8&quot;,ttype:BIG},{input:&quot;\\bigg&quot;,tag:&quot;mo&quot;,output:&quot;X&quot;,atval:&quot;2.3&quot;,ttype:BIG},{input:&quot;\\Bigg&quot;,tag:&quot;mo&quot;,output:&quot;X&quot;,atval:&quot;2.9&quot;,ttype:BIG},{input:&quot;\\left&quot;,tag:&quot;mo&quot;,output:&quot;X&quot;,ttype:LEFTBRACKET},{input:&quot;\\right&quot;,tag:&quot;mo&quot;,output:&quot;X&quot;,ttype:RIGHTBRACKET},{input:&quot;{&quot;,output:&quot;{&quot;,ttype:LEFTBRACKET,invisible:true},{input:&quot;}&quot;,output:&quot;}&quot;,ttype:RIGHTBRACKET,invisible:true},{input:&quot;(&quot;,tag:&quot;mo&quot;,output:&quot;(&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;[&quot;,tag:&quot;mo&quot;,output:&quot;[&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\lbrack&quot;,tag:&quot;mo&quot;,output:&quot;[&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\{&quot;,tag:&quot;mo&quot;,output:&quot;{&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\lbrace&quot;,tag:&quot;mo&quot;,output:&quot;{&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\langle&quot;,tag:&quot;mo&quot;,output:&quot;\u2329&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\lfloor&quot;,tag:&quot;mo&quot;,output:&quot;\u230A&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\lceil&quot;,tag:&quot;mo&quot;,output:&quot;\u2308&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;)&quot;,tag:&quot;mo&quot;,output:&quot;)&quot;,rtag:&quot;mi&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;]&quot;,tag:&quot;mo&quot;,output:&quot;]&quot;,rtag:&quot;mi&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\rbrack&quot;,tag:&quot;mo&quot;,output:&quot;]&quot;,rtag:&quot;mi&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\}&quot;,tag:&quot;mo&quot;,output:&quot;}&quot;,rtag:&quot;mi&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\rbrace&quot;,tag:&quot;mo&quot;,output:&quot;}&quot;,rtag:&quot;mi&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\rangle&quot;,tag:&quot;mo&quot;,output:&quot;\u232A&quot;,rtag:&quot;mi&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\rfloor&quot;,tag:&quot;mo&quot;,output:&quot;\u230B&quot;,rtag:&quot;mi&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\rceil&quot;,tag:&quot;mo&quot;,output:&quot;\u2309&quot;,rtag:&quot;mi&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;|&quot;,tag:&quot;mo&quot;,output:&quot;\u2223&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\|&quot;,tag:&quot;mo&quot;,output:&quot;\u2225&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\vert&quot;,tag:&quot;mo&quot;,output:&quot;\u2223&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\Vert&quot;,tag:&quot;mo&quot;,output:&quot;\u2225&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\mid&quot;,tag:&quot;mo&quot;,output:&quot;\u2223&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\parallel&quot;,tag:&quot;mo&quot;,output:&quot;\u2225&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;/&quot;,tag:&quot;mo&quot;,output:&quot;/&quot;,atval:&quot;1.01&quot;,ttype:STRETCHY},{input:&quot;\\backslash&quot;,tag:&quot;mo&quot;,output:&quot;\u2216&quot;,atval:&quot;1&quot;,ttype:STRETCHY},{input:&quot;\\setminus&quot;,tag:&quot;mo&quot;,output:&quot;\\&quot;,ttype:CONST},{input:&quot;\\!&quot;,tag:&quot;mspace&quot;,atname:&quot;width&quot;,atval:&quot;-0.167em&quot;,ttype:SPACE},{input:&quot;\\,&quot;,tag:&quot;mspace&quot;,atname:&quot;width&quot;,atval:&quot;0.167em&quot;,ttype:SPACE},{input:&quot;\\&gt;&quot;,tag:&quot;mspace&quot;,atname:&quot;width&quot;,atval:&quot;0.222em&quot;,ttype:SPACE},{input:&quot;\\:&quot;,tag:&quot;mspace&quot;,atname:&quot;width&quot;,atval:&quot;0.222em&quot;,ttype:SPACE},{input:&quot;\\;&quot;,tag:&quot;mspace&quot;,atname:&quot;width&quot;,atval:&quot;0.278em&quot;,ttype:SPACE},{input:&quot;~&quot;,tag:&quot;mspace&quot;,atname:&quot;width&quot;,atval:&quot;0.333em&quot;,ttype:SPACE},{input:&quot;\\quad&quot;,tag:&quot;mspace&quot;,atname:&quot;width&quot;,atval:&quot;1em&quot;,ttype:SPACE},{input:&quot;\\qquad&quot;,tag:&quot;mspace&quot;,atname:&quot;width&quot;,atval:&quot;2em&quot;,ttype:SPACE},{input:&quot;\\prime&quot;,tag:&quot;mo&quot;,output:&quot;\u2032&quot;,ttype:CONST},{input:&quot;'&quot;,tag:&quot;mo&quot;,output:&quot;\u02B9&quot;,ttype:CONST},{input:&quot;''&quot;,tag:&quot;mo&quot;,output:&quot;\u02BA&quot;,ttype:CONST},{input:&quot;'''&quot;,tag:&quot;mo&quot;,output:&quot;\u2034&quot;,ttype:CONST},{input:&quot;''''&quot;,tag:&quot;mo&quot;,output:&quot;\u2057&quot;,ttype:CONST},{input:&quot;\\ldots&quot;,tag:&quot;mo&quot;,output:&quot;\u2026&quot;,ttype:CONST},{input:&quot;\\cdots&quot;,tag:&quot;mo&quot;,output:&quot;\u22EF&quot;,ttype:CONST},{input:&quot;\\vdots&quot;,tag:&quot;mo&quot;,output:&quot;\u22EE&quot;,ttype:CONST},{input:&quot;\\ddots&quot;,tag:&quot;mo&quot;,output:&quot;\u22F1&quot;,ttype:CONST},{input:&quot;\\forall&quot;,tag:&quot;mo&quot;,output:&quot;\u2200&quot;,ttype:CONST},{input:&quot;\\exists&quot;,tag:&quot;mo&quot;,output:&quot;\u2203&quot;,ttype:CONST},{input:&quot;\\Re&quot;,tag:&quot;mo&quot;,output:&quot;\u211C&quot;,ttype:CONST},{input:&quot;\\Im&quot;,tag:&quot;mo&quot;,output:&quot;\u2111&quot;,ttype:CONST},{input:&quot;\\aleph&quot;,tag:&quot;mo&quot;,output:&quot;\u2135&quot;,ttype:CONST},{input:&quot;\\hbar&quot;,tag:&quot;mo&quot;,output:&quot;\u210F&quot;,ttype:CONST},{input:&quot;\\ell&quot;,tag:&quot;mo&quot;,output:&quot;\u2113&quot;,ttype:CONST},{input:&quot;\\wp&quot;,tag:&quot;mo&quot;,output:&quot;\u2118&quot;,ttype:CONST},{input:&quot;\\emptyset&quot;,tag:&quot;mo&quot;,output:&quot;\u2205&quot;,ttype:CONST},{input:&quot;\\infty&quot;,tag:&quot;mo&quot;,output:&quot;\u221E&quot;,ttype:CONST},{input:&quot;\\surd&quot;,tag:&quot;mo&quot;,output:&quot;\\sqrt{}&quot;,ttype:DEFINITION},{input:&quot;\\partial&quot;,tag:&quot;mo&quot;,output:&quot;\u2202&quot;,ttype:CONST},{input:&quot;\\nabla&quot;,tag:&quot;mo&quot;,output:&quot;\u2207&quot;,ttype:CONST},{input:&quot;\\triangle&quot;,tag:&quot;mo&quot;,output:&quot;\u25B3&quot;,ttype:CONST},{input:&quot;\\therefore&quot;,tag:&quot;mo&quot;,output:&quot;\u2234&quot;,ttype:CONST},{input:&quot;\\angle&quot;,tag:&quot;mo&quot;,output:&quot;\u2220&quot;,ttype:CONST},{input:&quot;\\diamond&quot;,tag:&quot;mo&quot;,output:&quot;\u22C4&quot;,ttype:CONST},{input:&quot;\\Diamond&quot;,tag:&quot;mo&quot;,output:&quot;\u25C7&quot;,ttype:CONST},{input:&quot;\\neg&quot;,tag:&quot;mo&quot;,output:&quot;\u00AC&quot;,ttype:CONST},{input:&quot;\\lnot&quot;,tag:&quot;mo&quot;,output:&quot;\u00AC&quot;,ttype:CONST},{input:&quot;\\bot&quot;,tag:&quot;mo&quot;,output:&quot;\u22A5&quot;,ttype:CONST},{input:&quot;\\top&quot;,tag:&quot;mo&quot;,output:&quot;\u22A4&quot;,ttype:CONST},{input:&quot;\\square&quot;,tag:&quot;mo&quot;,output:&quot;\u25AB&quot;,ttype:CONST},{input:&quot;\\Box&quot;,tag:&quot;mo&quot;,output:&quot;\u25A1&quot;,ttype:CONST},{input:&quot;\\wr&quot;,tag:&quot;mo&quot;,output:&quot;\u2240&quot;,ttype:CONST},{input:&quot;\\arccos&quot;,tag:&quot;mi&quot;,output:&quot;arccos&quot;,ttype:UNARY,func:true},{input:&quot;\\arcsin&quot;,tag:&quot;mi&quot;,output:&quot;arcsin&quot;,ttype:UNARY,func:true},{input:&quot;\\arctan&quot;,tag:&quot;mi&quot;,output:&quot;arctan&quot;,ttype:UNARY,func:true},{input:&quot;\\arg&quot;,tag:&quot;mi&quot;,output:&quot;arg&quot;,ttype:UNARY,func:true},{input:&quot;\\cos&quot;,tag:&quot;mi&quot;,output:&quot;cos&quot;,ttype:UNARY,func:true},{input:&quot;\\cosh&quot;,tag:&quot;mi&quot;,output:&quot;cosh&quot;,ttype:UNARY,func:true},{input:&quot;\\cot&quot;,tag:&quot;mi&quot;,output:&quot;cot&quot;,ttype:UNARY,func:true},{input:&quot;\\coth&quot;,tag:&quot;mi&quot;,output:&quot;coth&quot;,ttype:UNARY,func:true},{input:&quot;\\csc&quot;,tag:&quot;mi&quot;,output:&quot;csc&quot;,ttype:UNARY,func:true},{input:&quot;\\deg&quot;,tag:&quot;mi&quot;,output:&quot;deg&quot;,ttype:UNARY,func:true},{input:&quot;\\det&quot;,tag:&quot;mi&quot;,output:&quot;det&quot;,ttype:UNARY,func:true},{input:&quot;\\dim&quot;,tag:&quot;mi&quot;,output:&quot;dim&quot;,ttype:UNARY,func:true},{input:&quot;\\exp&quot;,tag:&quot;mi&quot;,output:&quot;exp&quot;,ttype:UNARY,func:true},{input:&quot;\\gcd&quot;,tag:&quot;mi&quot;,output:&quot;gcd&quot;,ttype:UNARY,func:true},{input:&quot;\\hom&quot;,tag:&quot;mi&quot;,output:&quot;hom&quot;,ttype:UNARY,func:true},{input:&quot;\\inf&quot;,tag:&quot;mo&quot;,output:&quot;inf&quot;,ttype:UNDEROVER},{input:&quot;\\ker&quot;,tag:&quot;mi&quot;,output:&quot;ker&quot;,ttype:UNARY,func:true},{input:&quot;\\lg&quot;,tag:&quot;mi&quot;,output:&quot;lg&quot;,ttype:UNARY,func:true},{input:&quot;\\lim&quot;,tag:&quot;mo&quot;,output:&quot;lim&quot;,ttype:UNDEROVER},{input:&quot;\\liminf&quot;,tag:&quot;mo&quot;,output:&quot;liminf&quot;,ttype:UNDEROVER},{input:&quot;\\limsup&quot;,tag:&quot;mo&quot;,output:&quot;limsup&quot;,ttype:UNDEROVER},{input:&quot;\\ln&quot;,tag:&quot;mi&quot;,output:&quot;ln&quot;,ttype:UNARY,func:true},{input:&quot;\\log&quot;,tag:&quot;mi&quot;,output:&quot;log&quot;,ttype:UNARY,func:true},{input:&quot;\\max&quot;,tag:&quot;mo&quot;,output:&quot;max&quot;,ttype:UNDEROVER},{input:&quot;\\min&quot;,tag:&quot;mo&quot;,output:&quot;min&quot;,ttype:UNDEROVER},{input:&quot;\\Pr&quot;,tag:&quot;mi&quot;,output:&quot;Pr&quot;,ttype:UNARY,func:true},{input:&quot;\\sec&quot;,tag:&quot;mi&quot;,output:&quot;sec&quot;,ttype:UNARY,func:true},{input:&quot;\\sin&quot;,tag:&quot;mi&quot;,output:&quot;sin&quot;,ttype:UNARY,func:true},{input:&quot;\\sinh&quot;,tag:&quot;mi&quot;,output:&quot;sinh&quot;,ttype:UNARY,func:true},{input:&quot;\\sup&quot;,tag:&quot;mo&quot;,output:&quot;sup&quot;,ttype:UNDEROVER},{input:&quot;\\tan&quot;,tag:&quot;mi&quot;,output:&quot;tan&quot;,ttype:UNARY,func:true},{input:&quot;\\tanh&quot;,tag:&quot;mi&quot;,output:&quot;tanh&quot;,ttype:UNARY,func:true},{input:&quot;\\gets&quot;,tag:&quot;mo&quot;,output:&quot;\u2190&quot;,ttype:CONST},{input:&quot;\\leftarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u2190&quot;,ttype:CONST},{input:&quot;\\to&quot;,tag:&quot;mo&quot;,output:&quot;\u2192&quot;,ttype:CONST},{input:&quot;\\rightarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u2192&quot;,ttype:CONST},{input:&quot;\\leftrightarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u2194&quot;,ttype:CONST},{input:&quot;\\uparrow&quot;,tag:&quot;mo&quot;,output:&quot;\u2191&quot;,ttype:CONST},{input:&quot;\\downarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u2193&quot;,ttype:CONST},{input:&quot;\\updownarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u2195&quot;,ttype:CONST},{input:&quot;\\Leftarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u21D0&quot;,ttype:CONST},{input:&quot;\\Rightarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u21D2&quot;,ttype:CONST},{input:&quot;\\Leftrightarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u21D4&quot;,ttype:CONST},{input:&quot;\\iff&quot;,tag:&quot;mo&quot;,output:&quot;~\\Longleftrightarrow~&quot;,ttype:DEFINITION},{input:&quot;\\Uparrow&quot;,tag:&quot;mo&quot;,output:&quot;\u21D1&quot;,ttype:CONST},{input:&quot;\\Downarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u21D3&quot;,ttype:CONST},{input:&quot;\\Updownarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u21D5&quot;,ttype:CONST},{input:&quot;\\mapsto&quot;,tag:&quot;mo&quot;,output:&quot;\u21A6&quot;,ttype:CONST},{input:&quot;\\longleftarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u27F5&quot;,ttype:CONST},{input:&quot;\\longrightarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u27F6&quot;,ttype:CONST},{input:&quot;\\longleftrightarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u27F7&quot;,ttype:CONST},{input:&quot;\\Longleftarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u27F8&quot;,ttype:CONST},{input:&quot;\\Longrightarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u27F9&quot;,ttype:CONST},{input:&quot;\\Longleftrightarrow&quot;,tag:&quot;mo&quot;,output:&quot;\u27FA&quot;,ttype:CONST},{input:&quot;\\longmapsto&quot;,tag:&quot;mo&quot;,output:&quot;\u27FC&quot;,ttype:CONST},{input:&quot;\\sqrt&quot;,tag:&quot;msqrt&quot;,output:&quot;sqrt&quot;,ttype:UNARY},{input:&quot;\\root&quot;,tag:&quot;mroot&quot;,output:&quot;root&quot;,ttype:BINARY},{input:&quot;\\frac&quot;,tag:&quot;mfrac&quot;,output:&quot;/&quot;,ttype:BINARY},{input:&quot;\\stackrel&quot;,tag:&quot;mover&quot;,output:&quot;stackrel&quot;,ttype:BINARY},{input:&quot;\\atop&quot;,tag:&quot;mfrac&quot;,output:&quot;&quot;,ttype:INFIX},{input:&quot;\\choose&quot;,tag:&quot;mfrac&quot;,output:&quot;&quot;,ttype:INFIX},{input:&quot;\\over&quot;,tag:&quot;mfrac&quot;,output:&quot;/&quot;,ttype:INFIX},{input:&quot;_&quot;,tag:&quot;msub&quot;,output:&quot;_&quot;,ttype:INFIX},{input:&quot;^&quot;,tag:&quot;msup&quot;,output:&quot;^&quot;,ttype:INFIX},{input:&quot;\\mbox&quot;,tag:&quot;mtext&quot;,output:&quot;mbox&quot;,ttype:TEXT},{input:&quot;\\acute&quot;,tag:&quot;mover&quot;,output:&quot;\u00B4&quot;,ttype:UNARY,acc:true},{input:&quot;\\grave&quot;,tag:&quot;mover&quot;,output:&quot;\u0060&quot;,ttype:UNARY,acc:true},{input:&quot;\\breve&quot;,tag:&quot;mover&quot;,output:&quot;\u02D8&quot;,ttype:UNARY,acc:true},{input:&quot;\\check&quot;,tag:&quot;mover&quot;,output:&quot;\u02C7&quot;,ttype:UNARY,acc:true},{input:&quot;\\dot&quot;,tag:&quot;mover&quot;,output:&quot;.&quot;,ttype:UNARY,acc:true},{input:&quot;\\ddot&quot;,tag:&quot;mover&quot;,output:&quot;..&quot;,ttype:UNARY,acc:true},{input:&quot;\\mathring&quot;,tag:&quot;mover&quot;,output:&quot;\u00B0&quot;,ttype:UNARY,acc:true},{input:&quot;\\vec&quot;,tag:&quot;mover&quot;,output:&quot;\u2192&quot;,ttype:UNARY,acc:true},{input:&quot;\\overrightarrow&quot;,tag:&quot;mover&quot;,output:&quot;\u2192&quot;,ttype:UNARY,acc:true},{input:&quot;\\overleftarrow&quot;,tag:&quot;mover&quot;,output:&quot;\u2190&quot;,ttype:UNARY,acc:true},{input:&quot;\\hat&quot;,tag:&quot;mover&quot;,output:&quot;\u005E&quot;,ttype:UNARY,acc:true},{input:&quot;\\widehat&quot;,tag:&quot;mover&quot;,output:&quot;\u0302&quot;,ttype:UNARY,acc:true},{input:&quot;\\tilde&quot;,tag:&quot;mover&quot;,output:&quot;~&quot;,ttype:UNARY,acc:true},{input:&quot;\\widetilde&quot;,tag:&quot;mover&quot;,output:&quot;\u02DC&quot;,ttype:UNARY,acc:true},{input:&quot;\\bar&quot;,tag:&quot;mover&quot;,output:&quot;\u203E&quot;,ttype:UNARY,acc:true},{input:&quot;\\overbrace&quot;,tag:&quot;mover&quot;,output:&quot;\u23B4&quot;,ttype:UNARY,acc:true},{input:&quot;\\overline&quot;,tag:&quot;mover&quot;,output:&quot;\u00AF&quot;,ttype:UNARY,acc:true},{input:&quot;\\underbrace&quot;,tag:&quot;munder&quot;,output:&quot;\u23B5&quot;,ttype:UNARY,acc:true},{input:&quot;\\underline&quot;,tag:&quot;munder&quot;,output:&quot;\u00AF&quot;,ttype:UNARY,acc:true},{input:&quot;\\displaystyle&quot;,tag:&quot;mstyle&quot;,atname:&quot;displaystyle&quot;,atval:&quot;true&quot;,ttype:UNARY},{input:&quot;\\textstyle&quot;,tag:&quot;mstyle&quot;,atname:&quot;displaystyle&quot;,atval:&quot;false&quot;,ttype:UNARY},{input:&quot;\\scriptstyle&quot;,tag:&quot;mstyle&quot;,atname:&quot;scriptlevel&quot;,atval:&quot;1&quot;,ttype:UNARY},{input:&quot;\\scriptscriptstyle&quot;,tag:&quot;mstyle&quot;,atname:&quot;scriptlevel&quot;,atval:&quot;2&quot;,ttype:UNARY},{input:&quot;\\mathrm&quot;,tag:&quot;mtext&quot;,output:&quot;text&quot;,ttype:TEXT},{input:&quot;\\textrm&quot;,tag:&quot;mtext&quot;,output:&quot;text&quot;,ttype:TEXT},{input:&quot;\\mathbf&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;bold&quot;,ttype:UNARY},{input:&quot;\\textbf&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;bold&quot;,ttype:UNARY},{input:&quot;\\mathit&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;italic&quot;,ttype:UNARY},{input:&quot;\\textit&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;italic&quot;,ttype:UNARY},{input:&quot;\\mathtt&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;monospace&quot;,ttype:UNARY},{input:&quot;\\texttt&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;monospace&quot;,ttype:UNARY},{input:&quot;\\mathsf&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;sans-serif&quot;,ttype:UNARY},{input:&quot;\\mathbb&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;double-struck&quot;,ttype:UNARY,codes:bbb},{input:&quot;\\mathcal&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;script&quot;,ttype:UNARY,codes:cal},{input:&quot;\\mathfrak&quot;,tag:&quot;mstyle&quot;,atname:&quot;mathvariant&quot;,atval:&quot;fraktur&quot;,ttype:UNARY,codes:frk}];var names=[];var mathVariant=&quot;italic&quot;;if(!document.createElementNS){document.createElementNS=function(link,type){return this.createElement(type)}}function compareNames(x,y){if(x.input&gt;y.input){return 1}else{return -1}}function refreshSymbols(){var len=symbols.length;symbols.sort(compareNames);for(var i=0;i&lt;len;i++){names[i]=symbols[i].input}}function strim(str,n){return $.trim(str.slice(n))}function createElementXHTML(elType){return document.createElementNS(&quot;http://www.w3.org/1999/xhtml&quot;,elType)}function position(str,n){var pos=$.inArray(str,names.slice(n));if(pos&lt;0){var narr=names.concat([str]);narr.sort();pos=$.inArray(str,narr.slice(n))}return n+pos}function getSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match=&quot;&quot;;var more=true;var sLen=str.length;for(var i=1;i&lt;=sLen&amp;&amp;more;i++){st=str.slice(0,i);j=k;k=position(st,j);if(k&lt;names.length&amp;&amp;str.slice(0,names[k].length)==names[k]){match=names[k];mk=k;i=match.length}more=k&lt;names.length&amp;&amp;str.slice(0,names[k].length)&gt;=names[k]}if(match!==&quot;&quot;){return symbols[mk]}k=1;st=str.slice(0,1);if(&quot;0&quot;&lt;=st&amp;&amp;st&lt;=&quot;9&quot;){tagst=&quot;mn&quot;}else{tagst=((&quot;A&quot;&gt;st||st&gt;&quot;Z&quot;)&amp;&amp;(&quot;a&quot;&gt;st||st&gt;&quot;z&quot;)?&quot;mo&quot;:&quot;mi&quot;)}return{input:st,tag:tagst,output:st,ttype:CONST}}function parseSexpr(str){var symbol,node,result,result2,i,st,newFrag=document.createDocumentFragment();var ch,newst,text=&quot;&quot;;symbol=getSymbol(str);if(symbol===null||symbol.ttype==RIGHTBRACKET){return[null,str,null]}if(symbol.ttype==DEFINITION){str=symbol.output+strim(str,symbol.input.length);symbol=getSymbol(str);if(symbol===null||symbol.ttype==RIGHTBRACKET){return[null,str,null]}}if(symbol.ttype==CONST&amp;&amp;symbol.tag==&quot;mi&quot;&amp;&amp;str!=&quot;&quot;){while(symbol.ttype==CONST&amp;&amp;symbol.tag==&quot;mi&quot;&amp;&amp;str!=&quot;&quot;){text+=symbol.output;str=strim(str,symbol.input.length);symbol=getSymbol(str)}node=createMmlNode(&quot;mi&quot;,document.createTextNode(text));node.setAttribute(&quot;mathvariant&quot;,mathVariant);return[node,str,&quot;mi&quot;]}else{str=strim(str,symbol.input.length)}switch(symbol.ttype){case SPACE:node=createMmlNode(symbol.tag);node.setAttribute(symbol.atname,symbol.atval);return[node,str,symbol.tag];case UNDEROVER:return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));return[node,str,symbol.tag];case STRETCHY:node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));if(symbol.input==&quot;|&quot;||symbol.input==&quot;\\vert&quot;||symbol.input==&quot;\\|&quot;||symbol.input==&quot;\\Vert&quot;){node.setAttribute(&quot;lspace&quot;,&quot;0em&quot;);node.setAttribute(&quot;rspace&quot;,&quot;0em&quot;)}node.setAttribute(&quot;maxsize&quot;,symbol.atval);if(symbol.rtag!==null){return[node,str,symbol.rtag]}else{return[node,str,symbol.tag]}break;case BIG:var atval=symbol.atval;symbol=getSymbol(str);if(symbol===null){return[null,str,null]}str=strim(str,symbol.input.length);node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));node.setAttribute(&quot;minsize&quot;,atval);node.setAttribute(&quot;maxsize&quot;,atval);return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input==&quot;\\left&quot;){symbol=getSymbol(str);if(symbol!==null){if(symbol.input==&quot;.&quot;){symbol.invisible=true}str=strim(str,symbol.input.length)}}result=parseExpr(str,true,false);if(symbol===null||(typeof symbol.invisible==&quot;boolean&quot;&amp;&amp;symbol.invisible)){node=createMmlNode(&quot;mrow&quot;,result[0])}else{node=createMmlNode(&quot;mo&quot;,document.createTextNode(symbol.output));node=createMmlNode(&quot;mrow&quot;,node);node.appendChild(result[0])}return[node,result[1],result[2]];case MATRIX:if(symbol.input==&quot;\\begin{array}&quot;){var mask=&quot;&quot;;symbol=getSymbol(str);str=$.trim(str);if(symbol===null){mask=&quot;l&quot;}else{str=strim(str,symbol.input.length);if(symbol.input!=&quot;{&quot;){mask=&quot;l&quot;}else{do{symbol=getSymbol(str);if(symbol!==null){str=strim(str,symbol.input.length);if(symbol.input!=&quot;}&quot;){mask=mask+symbol.input}}}while(symbol!==null&amp;&amp;symbol.input!==&quot;&quot;&amp;&amp;symbol.input!=&quot;}&quot;)}}result=parseExpr(&quot;{&quot;+str,true,true);node=createMmlNode(&quot;mtable&quot;,result[0]);mask=mask.replace(/l/g,&quot;left &quot;);mask=mask.replace(/r/g,&quot;right &quot;);mask=mask.replace(/c/g,&quot;center &quot;);node.setAttribute(&quot;columnalign&quot;,mask);node.setAttribute(&quot;displaystyle&quot;,&quot;false&quot;);return[node,result[1],null]}else{result=parseExpr(&quot;{&quot;+str,true,true);node=createMmlNode(&quot;mtable&quot;,result[0]);node.setAttribute(&quot;columnalign&quot;,&quot;right center left&quot;);node.setAttribute(&quot;displaystyle&quot;,&quot;true&quot;);node=createMmlNode(&quot;mrow&quot;,node);return[node,result[1],null]}break;case TEXT:if(str.charAt(0)==&quot;{&quot;){i=str.indexOf(&quot;}&quot;)}else{i=0}if(i==-1){i=str.length}st=str.slice(1,i);node=createMmlNode(symbol.tag,document.createTextNode(st));newFrag.appendChild(node);str=strim(str,i+1);return[createMmlNode(&quot;mrow&quot;,newFrag),str,null];case UNARY:if(symbol.atname==&quot;mathvariant&quot;){mathVariant=symbol.atval}result=parseSexpr(str);if(result[0]===null){return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str]}if(typeof symbol.func==&quot;boolean&quot;&amp;&amp;symbol.func){st=str.charAt(0);if(st==&quot;^&quot;||st==&quot;_&quot;||st==&quot;,&quot;){return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag]}else{node=createMmlNode(&quot;mrow&quot;,createMmlNode(symbol.tag,document.createTextNode(symbol.output)));node.appendChild(result[0]);return[node,result[1],symbol.tag]}}if(symbol.input==&quot;\\sqrt&quot;){return[createMmlNode(symbol.tag,result[0]),result[1],symbol.tag]}else{if(typeof symbol.acc==&quot;boolean&quot;&amp;&amp;symbol.acc){node=createMmlNode(symbol.tag,result[0]);var output=symbol.output;var node1=createMmlNode(&quot;mo&quot;,document.createTextNode(output));if(symbol.input==&quot;\\vec&quot;||symbol.input==&quot;\\check&quot;){node1.setAttribute(&quot;maxsize&quot;,&quot;1.2&quot;)}if(symbol.input==&quot;\\underbrace&quot;||symbol.input==&quot;\\underline&quot;){node1.setAttribute(&quot;accentunder&quot;,&quot;true&quot;)}else{node1.setAttribute(&quot;accent&quot;,&quot;true&quot;)}node.appendChild(node1);if(symbol.input==&quot;\\overbrace&quot;||symbol.input==&quot;\\underbrace&quot;){node.ttype=UNDEROVER}return[node,result[1],symbol.tag]}else{if(typeof symbol.codes!=&quot;undefined&quot;){for(i=0;i&lt;result[0].childNodes.length;i++){if(result[0].childNodes[i].nodeName==&quot;mi&quot;||result[0].nodeName==&quot;mi&quot;){st=(result[0].nodeName==&quot;mi&quot;?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);newst=&quot;&quot;;for(var j=0;j&lt;st.length;j++){ch=st.charCodeAt(j);if(ch&gt;64&amp;&amp;ch&lt;91){newst=newst+symbol.codes[ch-65]}else{if(ch&gt;96&amp;&amp;ch&lt;123){newst=newst+symbol.codes[ch-71]}}}if(result[0].nodeName==&quot;mi&quot;){result[0]=createMmlNode(&quot;mo&quot;).appendChild(document.createTextNode(newst))}else{result[0].replaceChild(createMmlNode(&quot;mo&quot;).appendChild(document.createTextNode(newst)),result[0].childNodes[i])}}}}node=createMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input==&quot;\\scriptstyle&quot;||symbol.input==&quot;\\scriptscriptstyle&quot;){node.setAttribute(&quot;displaystyle&quot;,&quot;false&quot;)}return[node,result[1],symbol.tag]}}break;case BINARY:result=parseSexpr(str);if(result[0]===null){return[createMmlNode(&quot;mo&quot;,document.createTextNode(symbol.input)),str,null]}result2=parseSexpr(result[1]);if(result2[0]===null){return[createMmlNode(&quot;mo&quot;,document.createTextNode(symbol.input)),str,null]}if(symbol.input==&quot;\\root&quot;||symbol.input==&quot;\\stackrel&quot;){newFrag.appendChild(result2[0])}newFrag.appendChild(result[0]);if(symbol.input==&quot;\\frac&quot;){newFrag.appendChild(result2[0])}return[createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];case INFIX:str=strim(str,symbol.input.length);return[createMmlNode(&quot;mo&quot;,document.createTextNode(symbol.output)),str,symbol.tag];default:return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag]}}function parseIexpr(str){var symbol,sym1,sym2,node,result,tag,underover;sym1=getSymbol(str);result=parseSexpr(str);node=result[0];str=result[1];tag=result[2];symbol=getSymbol(str);if(symbol.ttype==INFIX){str=strim(str,symbol.input.length);result=parseSexpr(str);if(result[0]===null){result[0]=createMmlNode(&quot;mo&quot;,document.createTextNode(&quot;\u25A1&quot;))}str=result[1];tag=result[2];if(symbol.input==&quot;_&quot;||symbol.input==&quot;^&quot;){sym2=getSymbol(str);tag=null;underover=((sym1.ttype==UNDEROVER)||(node.ttype==UNDEROVER));if((symbol.input==&quot;_&quot;&amp;&amp;sym2.input==&quot;^&quot;)||(symbol.input==&quot;^&quot;&amp;&amp;sym2.input==&quot;_&quot;)){str=strim(str,sym2.input.length);var res2=parseSexpr(str);str=res2[1];tag=res2[2];node=createMmlNode((underover?&quot;munderover&quot;:&quot;msubsup&quot;),node);if(symbol.input==&quot;_&quot;){node.appendChild(result[0]);node.appendChild(res2[0])}else{node.appendChild(res2[0]);node.appendChild(result[0])}}else{if(symbol.input==&quot;_&quot;){node=createMmlNode((underover?&quot;munder&quot;:&quot;msub&quot;),node);node.appendChild(result[0])}else{node=createMmlNode((underover?&quot;mover&quot;:&quot;msup&quot;),node);node.appendChild(result[0])}}node=createMmlNode(&quot;mrow&quot;,node)}else{node=createMmlNode(symbol.tag,node);if(symbol.input==&quot;\\atop&quot;||symbol.input==&quot;\\choose&quot;){node.setAttribute(&quot;linethickness&quot;,&quot;0ex&quot;)}node.appendChild(result[0]);if(symbol.input==&quot;\\choose&quot;){node=createMmlNode(&quot;mfenced&quot;,node)}}}return[node,str,tag]}function parseExpr(str,rightbracket,matrix){var symbol,node,result,i,tag,newFrag=document.createDocumentFragment();do{str=$.trim(str);result=parseIexpr(str);node=result[0];str=result[1];tag=result[2];symbol=getSymbol(str);if(node){if((tag==&quot;mn&quot;||tag==&quot;mi&quot;)&amp;&amp;symbol!==null&amp;&amp;typeof symbol.func==&quot;boolean&quot;&amp;&amp;symbol.func){var space=createMmlNode(&quot;mspace&quot;);space.setAttribute(&quot;width&quot;,&quot;0.167em&quot;);node=createMmlNode(&quot;mrow&quot;,node);node.appendChild(space)}if(tag==&quot;mstyle&quot;){mathVariant=&quot;italic&quot;}newFrag.appendChild(node)}}while((symbol.ttype!=RIGHTBRACKET)&amp;&amp;symbol!==null&amp;&amp;symbol.output!==&quot;&quot;);tag=null;if(symbol.ttype==RIGHTBRACKET){if(symbol.input==&quot;\\right&quot;){str=strim(str,symbol.input.length);symbol=getSymbol(str);if(symbol!==null&amp;&amp;symbol.input==&quot;.&quot;){symbol.invisible=true}if(symbol!==null){tag=symbol.rtag}}if(symbol!==null){str=strim(str,symbol.input.length)}var len=newFrag.childNodes.length;if(matrix&amp;&amp;len&gt;0&amp;&amp;newFrag.childNodes[len-1].nodeName==&quot;mrow&quot;){var pos=[];var m=newFrag.childNodes.length;for(i=0;matrix&amp;&amp;i&lt;m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];for(var j=0;j&lt;node.childNodes.length;j++){if(node.childNodes[j].firstChild&amp;&amp;node.childNodes[j].firstChild.nodeValue==&quot;&amp;&quot;){pos[i][pos[i].length]=j}}}var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i&lt;m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;for(j=0;j&lt;n;j++){if(typeof pos[i][k]!=&quot;undefined&quot;&amp;&amp;j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(createMmlNode(&quot;mtd&quot;,frag));k++}else{frag.appendChild(node.firstChild)}}row.appendChild(createMmlNode(&quot;mtd&quot;,frag));if(newFrag.childNodes.length&gt;2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild)}table.appendChild(createMmlNode(&quot;mtr&quot;,row))}return[table,str]}if(typeof symbol.invisible!=&quot;boolean&quot;||!symbol.invisible){node=createMmlNode(&quot;mo&quot;,document.createTextNode(symbol.output));newFrag.appendChild(node)}}return[newFrag,str,tag]}function createMmlNode(t,frag){var node=document.createElementNS(&quot;http://www.w3.org/1998/Math/MathML&quot;,t);if(frag){$(node).append(frag)}return node}var SVG,canvas;var collection=[];function createSVGElement(elType){return document.createElementNS(&quot;http://www.w3.org/2000/svg&quot;,elType)}function getSVGElement(id,el){var res={node:null,newEl:false};if(id){id=SVG.id+&quot;_&quot;+id;res.node=$(&quot;#&quot;+id)[0]}if(!res.node){res.node=createSVGElement(el);if(id){res.node.id=id}res.newEl=true}return res}function openGroup(id,clear){var newEl=getSVGElement(id,&quot;g&quot;);appendSVG(newEl);canvas=$(&quot;#&quot;+SVG.id+&quot;_&quot;+id)[0];if(clear){$(canvas).empty()}}function closeGroup(){canvas=$(&quot;#&quot;+SVG.id+&quot;_Canvas&quot;)[0]}function appendSVG(elmt){if(elmt.newEl){$(canvas).append(elmt.node)}}function addButton(parent,text,title,func,id){var node=createElementXHTML(&quot;span&quot;);node.className=&quot;svgButton&quot;;node.title=title;node.onclick=func;if(id){node.id=id}$(node).append(text);$(node).css({paddingRight:&quot;0.5em&quot;,paddingLeft:&quot;0.5em&quot;,fontSize:&quot;1em&quot;,fontFamily:&quot;monospace&quot;,background:&quot;blue&quot;,color:&quot;yellow&quot;,cursor:&quot;pointer&quot;});$(node).mouseover(function(){$(this).css({background:&quot;yellow&quot;,color:&quot;blue&quot;})});$(node).mouseout(function(){$(this).css({background:&quot;blue&quot;,color:&quot;yellow&quot;})});$(parent).append(node);return parent}function pictureAttributes(){this.id=null;this.stroke=&quot;blue&quot;;this.strokewidth=1;this.strokeopacity=1;this.strokedasharray=&quot;none&quot;;this.fill=&quot;none&quot;;this.fillopacity=1;this.fixed=false;this.fontstyle=&quot;normal&quot;;this.fontfamily=&quot;serif&quot;;this.fontweight=&quot;normal&quot;;this.fontsize=12;this.fontstroke=&quot;none&quot;;this.fontstrokewidth=1;this.fontstrokeopacity=1;this.fontstrokedasharray=&quot;none&quot;;this.fontfill=&quot;black&quot;;this.fontfillopacity=1;this.sector=false;this.largearc=0;this.marker=&quot;o&quot;;this.orient=&quot;auto&quot;;this.size=8;this.units=&quot;userSpaceOnUse&quot;;this.markerstroke=&quot;blue&quot;;this.markerstrokewidth=1;this.markerstrokeopacity=1;this.markerstrokedasharray=&quot;none&quot;;this.markerfill=&quot;none&quot;;this.markerfillopacity=1;this.sweep=0;this.rx=0;this.ry=0;this.closed=false;this.curve=&quot;&quot;;this.direction=[1,0];this.ticklabels=&quot;&quot;;this.pos=&quot;&quot;;this.points=200;this.backgroundcolor=&quot;none&quot;;this.backgroundopacity=1}function pictureObject(){this.id=null;this.src=&quot;&quot;;this.width=320;this.height=null;this.factor=1;this.xmin=-5;this.xmax=5;this.ymin=null;this.ymax=null;this.xunitlength=null;this.yunitlength=null;this.origin=[0,0];this.mouse=[null,null];this.coords=&quot;cartesian&quot;;this.drag=null;this.pan=true;this.locked=false;this.attr=new pictureAttributes()}function drawPicture(){$(canvas).empty();$(&quot;#&quot;+SVG.id+&quot; .svgMarker&quot;).remove();SVG.attr=new pictureAttributes();try{this.code=function(){with(Math){eval(SVG.src)}}();this.code=null}catch(err){var errstr;if(typeof err==&quot;object&quot;){errstr=err.name+&quot; &quot;+err.message+&quot; &quot;+err.number+&quot; &quot;+err.description}else{errstr=err}alert(errstr+&quot;\n&quot;+SVG.src)}collection[SVG.id]=SVG}function setOptions(atr){for(var i in atr){SVG.attr[i]=atr[i]}}function getOptions(attr,options,prefix){var pref=prefix||&quot;&quot;;if(typeof attr==&quot;string&quot;){return(options[pref+attr]==undefined?SVG.attr[pref+attr]:options[pref+attr])}else{var i,newAttr={},len=attr.length,item;for(i=0;i&lt;len;i++){item=attr[i];newAttr[item]=options[pref+item]==undefined?SVG.attr[pref+item]:options[pref+item]}return newAttr}}function setAction(evt,fn,id){if(!$.isFunction(fn)){return}var node=id?$(&quot;#&quot;+SVG.id+&quot;_&quot;+id):$(&quot;#&quot;+SVG.id);$(node).bind(evt,fn)}function getAngle(p){p=p||[0,0];var res=Math.atan2(SVG.mouse[1]-p[1],SVG.mouse[0]-p[0]);res=(res&lt;0)?res+2*Math.PI:res;return res}function getDistance(p){p=p||[0,0];return Math.sqrt(Math.pow(SVG.mouse[0]-p[0],2)+Math.pow(SVG.mouse[1]-p[1],2))}function updateButton(){var obj=$(&quot;#SVGtoolbar #SVGupdateButton&quot;);if(obj.text()==&quot;Edit&quot;){obj.text(&quot;Update&quot;);obj.attr(&quot;title&quot;,&quot;Update picture&quot;);$(&quot;#SVGsrc&quot;).val(SVG.src).css(&quot;display&quot;,&quot;block&quot;)}else{SVG.src=$(&quot;#SVGsrc&quot;).val();drawPicture()}}function closeEditor(){$(&quot;#SVGtoolbar&quot;).slideUp();$(&quot;#SVGsrc&quot;).val(&quot;&quot;);SVG.locked=false}function switchTo(evt){var name=evt.currentTarget.id;if(SVG.id==name||SVG.locked){return false}SVG=collection[name];canvas=$(&quot;#&quot;+SVG.id+&quot;_Canvas&quot;)[0];return false}function onWheel(evt){if(SVG.locked){return false}evt=evt||window.event;var factor=1;evt.preventDefault();evt.stopPropagation();if(evt.wheelDelta){factor=(evt.wheelDelta&gt;0)?0.8:1.25}else{if(evt.detail){factor=(evt.detail&lt;0)?0.8:1.25}}if(evt.altKey){resize(factor)}else{zoom(factor)}return false}function onClick(evt){if(SVG.locked){return false}if(evt.button===0){if(evt.shiftKey){$(&quot;#SVGtoolbar #SVGupdateButton&quot;).text(&quot;Update&quot;);$(&quot;#SVGsrc&quot;).val(SVG.src);$(&quot;#SVGtoolbar&quot;).css({top:evt.pageY,left:evt.pageX}).slideDown();SVG.locked=true;evt.stopImmediatePropagation()}else{if(SVG.pan){SVG.drag=[evt.clientX,evt.clientY];document.body.style.cursor=&quot;move&quot;}}}return false}function onDrop(evt){if(SVG.drag==null){return false}document.body.style.cursor=&quot;default&quot;;var xlen=(SVG.drag[0]-evt.clientX)/SVG.xunitlength;var ylen=(-SVG.drag[1]+evt.clientY)/SVG.yunitlength;SVG.drag=null;if(xlen!=0||ylen!=0){setScales([SVG.xmin+xlen,SVG.xmax+xlen,SVG.ymin+ylen,SVG.ymax+ylen])}return false}function setScales(scales){if(scales){SVG.xmin=scales[0];SVG.xmax=scales[1];SVG.ymin=scales[2];SVG.ymax=scales[3]}SVG.xunitlength=SVG.width/(SVG.xmax-SVG.xmin);SVG.yunitlength=SVG.height/(SVG.ymax-SVG.ymin);SVG.origin=[-SVG.xmin*SVG.xunitlength,-SVG.ymin*SVG.yunitlength];drawPicture()}function getScales(scales){scales=scales||[];var res=[null,null,null,null,0];if(scales.length==0){res[0]=SVG.xmin;res[1]=SVG.xmax}if(scales.length&gt;1){if(typeof scales[0]==&quot;number&quot;&amp;&amp;typeof scales[1]==&quot;number&quot;&amp;&amp;scales[1]&gt;scales[0]){res[0]=scales[0];res[1]=scales[1];res[4]=4}else{res[0]=SVG.xmin;res[1]=SVG.xmax}}if(scales.length==4){if(typeof scales[2]==&quot;number&quot;&amp;&amp;typeof scales[3]==&quot;number&quot;&amp;&amp;scales[3]&gt;scales[2]){res[2]=scales[2];res[3]=scales[3];res[4]+=8}}return res}function resize(factor){SVG.factor=(SVG.factor*factor).toFixed(3);SVG.width/=factor;SVG.height/=factor;var picture=$(&quot;#&quot;+SVG.id);picture.attr(&quot;width&quot;,SVG.width);picture.attr(&quot;height&quot;,SVG.height);var parent=picture[0].parentNode;if(parent.nodeName==&quot;DIV&quot;){parent.style.width=SVG.width+&quot;px&quot;;parent.style.height=SVG.height+&quot;px&quot;}var node=$(&quot;#&quot;+SVG.id+&quot;ClipPath&quot;)[0].firstChild;$(node).attr(&quot;d&quot;,&quot;M0,0 &quot;+SVG.width+&quot;,0 &quot;+SVG.width+&quot;,&quot;+SVG.height+&quot; 0,&quot;+SVG.height);setScales()}function zoom(factor,center){var px,py;if(center){px=(SVG.xmax+SVG.xmin)*0.5;py=(SVG.ymax+SVG.ymin)*0.5}else{px=SVG.mouse[0];py=SVG.mouse[1]}SVG.factor=(SVG.factor*factor).toFixed(3);var dx=(SVG.xmax-SVG.xmin)*factor;var dy=(SVG.ymax-SVG.ymin)*factor;var xmin=(1-factor)*px+factor*SVG.xmin;var ymin=(1-factor)*py+factor*SVG.ymin;setScales([xmin,xmin+dx,ymin,ymin+dy])}function updateCartesianCoord(){if(!SVG.locked){$(&quot;#&quot;+SVG.id+&quot;_Coords&quot;).text(&quot;(&quot;+SVG.mouse[0].toFixed(2)+&quot;, &quot;+SVG.mouse[1].toFixed(2)+&quot;)&quot;)}return false}function updatePolarCoord(){if(!SVG.locked){$(&quot;#&quot;+SVG.id+&quot;_Coords&quot;).text(&quot;(&quot;+getDistance().toFixed(2)+&quot;, &quot;+getAngle().toFixed(2)+&quot;)&quot;)}return false}function getPosition(evt){var a=[null,null];var off=$(evt.currentTarget.parentNode).offset();a[0]=(evt.pageX-off.left-SVG.origin[0])/SVG.xunitlength;a[1]=(SVG.height-SVG.origin[1]-evt.pageY+off.top)/SVG.yunitlength;return a}function updatePosition(evt){SVG.mouse=getPosition(evt);return false}function removeCoord(){$(&quot;#&quot;+SVG.id+&quot;_Coords&quot;).text(&quot;&quot;);return false}function tracker(pos,options){options=options||{};var coords=options.coords||SVG.coords;var func=(coords==&quot;polar&quot;)?updatePolarCoord:updateCartesianCoord;options.id=&quot;Coords&quot;;options.fixed=true;text(pos,&quot;&quot;,options);setAction(&quot;mousemove&quot;,func);setAction(&quot;mouseout&quot;,removeCoord)}function exportSVG(){var svg=&quot;&lt;?xml version='1.0' encoding='UTF-8' standalone='no'?&gt;\n&quot;;svg+=$(&quot;#&quot;+SVG.id).parent().html();svg=svg.replace(/&amp;nbsp;/g,&quot;&quot;);svg=svg.replace(/&gt;&lt;(?!\/)/g,&quot;&gt;\n&lt;&quot;);$(&quot;#SVGtoolbar #SVGupdateButton&quot;).text(&quot;Edit&quot;).attr(&quot;title&quot;,&quot;Edit script&quot;);$(&quot;#SVGsrc&quot;).val(svg).css(&quot;display&quot;,&quot;block&quot;)}function toSVG(p){var x=p[0]*SVG.xunitlength+SVG.origin[0];var y=SVG.height-p[1]*SVG.yunitlength-SVG.origin[1];return[x,y]}function toSVGPair(p){var q=toSVG(p);return q[0]+&quot; &quot;+q[1]}function setStrokeAndFill(node,options,prefix){var attributes=[&quot;stroke&quot;,&quot;strokewidth&quot;,&quot;strokedasharray&quot;,&quot;strokeopacity&quot;,&quot;fill&quot;,&quot;fillopacity&quot;];var attr=getOptions(attributes,options,prefix);var elem=$(node);elem.attr(&quot;stroke&quot;,attr.stroke);elem.attr(&quot;stroke-width&quot;,attr.strokewidth/SVG.factor);elem.attr(&quot;stroke-dasharray&quot;,attr.strokedasharray);elem.attr(&quot;stroke-opacity&quot;,attr.strokeopacity);elem.attr(&quot;fill&quot;,attr.fill);elem.attr(&quot;fill-opacity&quot;,attr.fillopacity)}function button(p,q,txt,action,options){options=options||{};options.id=(options.id||Math.randomString(8));rect(p,q,options);setAction(&quot;click&quot;,action,options.id);options.fill=null;options.fillopacity=1;options.id+=&quot;_t&quot;;text([(p[0]+q[0])*0.5,(p[1]+q[1])*0.5],txt,options);setAction(&quot;click&quot;,action,options.id)}function setMarkers(obj,options){var markerChars=&quot;o*sSx+&lt;&gt;|&quot;;var attributes=[&quot;marker&quot;,&quot;size&quot;,&quot;units&quot;,&quot;orient&quot;,&quot;markerstroke&quot;,&quot;markerstrokewidth&quot;,&quot;markerstrokeopacity&quot;];var attr=getOptions(attributes,options);var node,node2,i,id,pos=[&quot;marker-start&quot;,&quot;marker-mid&quot;,&quot;marker-end&quot;];var lim=attr.marker.length;for(i=0;i&lt;lim;i++){var type=attr.marker.charAt(i);if(type==&quot;-&quot;||markerChars.indexOf(type)&lt;0){continue}id=(options.id||Math.randomString(8))+&quot;Marker_&quot;+markerChars.indexOf(type);node=$(&quot;#&quot;+SVG.id+&quot;_&quot;+id);if(node.length===0){node=$(getSVGElement(id,&quot;marker&quot;).node);node.attr(&quot;class&quot;,&quot;svgMarker&quot;);node.attr(&quot;viewBox&quot;,&quot;0 0 10 10&quot;);node.attr(&quot;refX&quot;,5);node.attr(&quot;refY&quot;,5);node.attr(&quot;orient&quot;,attr.orient);node.attr(&quot;markerUnits&quot;,attr.units);switch(type){case&quot;*&quot;:case&quot;o&quot;:node2=$(createSVGElement(&quot;circle&quot;));node2.attr(&quot;cx&quot;,5);node2.attr(&quot;cy&quot;,5);node2.attr(&quot;r&quot;,4);break;case&quot;&gt;&quot;:node2=$(createSVGElement(&quot;path&quot;));node2.attr(&quot;d&quot;,&quot;M0 0 L10 5 L0 10 z&quot;);node.attr(&quot;refX&quot;,10);break;case&quot;&lt;&quot;:node2=$(createSVGElement(&quot;path&quot;));node2.attr(&quot;d&quot;,&quot;M10 0 L10 10 L0 5 z&quot;);node.attr(&quot;refX&quot;,0);break;case&quot;x&quot;:node2=$(createSVGElement(&quot;path&quot;));node2.attr(&quot;d&quot;,&quot;M0 0 L10 10 M0 10 L10 0&quot;);break;case&quot;+&quot;:node2=$(createSVGElement(&quot;path&quot;));node2.attr(&quot;d&quot;,&quot;M5 0 L5 10 M0 5 L10 5&quot;);break;case&quot;|&quot;:node2=$(createSVGElement(&quot;path&quot;));node2.attr(&quot;d&quot;,&quot;M5 0 L5 10&quot;);break;case&quot;S&quot;:case&quot;s&quot;:node2=$(createSVGElement(&quot;rect&quot;));node2.attr(&quot;x&quot;,0);node2.attr(&quot;y&quot;,0);node2.attr(&quot;width&quot;,10);node2.attr(&quot;height&quot;,10)}setStrokeAndFill(node2,options,&quot;marker&quot;);node2.attr(&quot;stroke-width&quot;,attr.markerstrokewidth);if(&quot;*&lt;&gt;S&quot;.indexOf(type)&gt;-1){node2.attr(&quot;fill&quot;,attr.markerstroke);node2.attr(&quot;fill-opacity&quot;,attr.markerstrokeopacity)}node.append(node2);$(&quot;#&quot;+SVG.id+&quot;_Defs&quot;).append(node)}node.attr(&quot;markerWidth&quot;,attr.size/SVG.factor);node.attr(&quot;markerHeight&quot;,attr.size/SVG.factor);$(obj).attr(pos[i],&quot;url(#&quot;+SVG.id+&quot;_&quot;+id+&quot;)&quot;)}}function setLabels(p,options){var i,point=[0,0],pos;var label=(typeof options.label==&quot;string&quot;)?[options.label]:options.label;var labelpos=getOptions(&quot;pos&quot;,options);labelpos=(typeof labelpos==&quot;string&quot;)?[labelpos]:labelpos;var poslen=labelpos.length;var size=options.size||SVG.attr.size;var dx=(0.5*size/SVG.xunitlength)/SVG.factor;var dy=(0.5*size/SVG.yunitlength)/SVG.factor;for(i=0;i&lt;label.length;i++){options.isLabel=&quot;_label&quot;+i;point[0]=p[i][0];point[1]=p[i][1];pos=(poslen&gt;i)?labelpos[i].toUpperCase():pos;if(/E/.test(pos)){point[0]+=dx}if(/W/.test(pos)){point[0]-=dx}if(/N/.test(pos)){point[1]+=dy}if(/S/.test(pos)){point[1]-=dy}options.pos=pos;text(point,label[i],options)}}function line(p,q,options){options=options||{};options.closed=false;options.curve=&quot;&quot;;path([p,q],options)}function dot(p,options){options=options||{};var direction=getOptions(&quot;direction&quot;,options);var q=[p[0]+direction[0]/SVG.xunitlength,p[1]+direction[1]/SVG.yunitlength];var st=&quot;M&quot;+toSVGPair(p)+&quot; &quot;+toSVGPair(q);var elmt=getSVGElement(options.id,&quot;path&quot;);var elem=$(elmt.node);elem.attr(&quot;d&quot;,st);elem.attr(&quot;stroke&quot;,&quot;none&quot;);setMarkers(elem,options);appendSVG(elmt);if(options.label){setLabels([p],options)}}function path(list,options,append){options=options||{};var i,elmt=getSVGElement(options.id,&quot;path&quot;);var attr=getOptions([&quot;curve&quot;,&quot;closed&quot;],options);var len=list.length;if(len&gt;0){var node=$(elmt.node);var st=(append&amp;&amp;!elmt.newEl)?elmt.node.getAttribute(&quot;d&quot;):&quot;&quot;;st+=&quot;M&quot;+toSVGPair(list[0])+&quot; &quot;+attr.curve;for(i=1;i&lt;len;i++){st+=toSVGPair(list[i])+&quot; &quot;}if(attr.closed){st+=&quot;Z&quot;}node.attr(&quot;d&quot;,st);setStrokeAndFill(node,options);if(options.marker){setMarkers(node,options)}appendSVG(elmt);if(options.label){setLabels(list,options)}}}function rotate(id,angle,options){if(!id||!angle){return}var node=$(&quot;#&quot;+SVG.id+&quot;_&quot;+id)[0];if(node){options=options||{};var center=options.center?toSVG(options.center):SVG.origin;angle=-angle*180/Math.PI;var transform=node.getAttribute(&quot;transform&quot;)||&quot;&quot;;transform=&quot;rotate(&quot;+angle+&quot; &quot;+center+&quot;) &quot;+(options.replace?&quot;&quot;:transform);$(node).attr(&quot;transform&quot;,transform)}}function translate(id,delta,options){if(!id||!delta){return}var node=$(&quot;#&quot;+SVG.id+&quot;_&quot;+id)[0];if(node){options=options||{};delta=toSVG(delta);var transform=node.getAttribute(&quot;transform&quot;)||&quot;&quot;;transform=&quot;translate(&quot;+(delta[0]-SVG.origin[0])+&quot;  &quot;+(SVG.origin[1]+delta[1]-SVG.height)+&quot;) &quot;+(options.replace?&quot;&quot;:transform);$(node).attr(&quot;transform&quot;,transform)}}function curve(list,options){options=options||{};options.curve=options.curve||&quot;T&quot;;path(list,options)}function circle(center,radius,options){ellipse(center,radius,radius,options)}function loop(p,options){options=options||{};var d=options.direction||[1,0];options.curve=&quot;C&quot;;options.closed=false;path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],options)}function arc(options){options=options||{};var start=options.start;var end=options.end;var center=options.center;var startangle=options.startangle;var endangle=options.endangle;var st=&quot;M&quot;,elmt=getSVGElement(options.id,&quot;path&quot;);var attr=getOptions([&quot;largearc&quot;,&quot;sweep&quot;,&quot;closed&quot;,&quot;sector&quot;],options);var radius=options.radius;if(center!=null&amp;&amp;startangle!=null&amp;&amp;endangle!=null&amp;&amp;radius!=null){start=[radius*Math.cos(startangle)+center[0],radius*Math.sin(startangle)+center[1]];end=[radius*Math.cos(endangle)+center[0],radius*Math.sin(endangle)+center[1]]}if(start==null||end==null){return}if(!radius){var v=[end[0]-start[0],end[1]-start[1]];radius=Math.sqrt(v[0]*v[0]+v[1]*v[1])}if(attr.sector){st+=toSVGPair(center)+&quot; &quot;}st+=toSVGPair(start)+&quot; A&quot;+radius*SVG.xunitlength+&quot;,&quot;+radius*SVG.yunitlength+&quot; 0 &quot;+attr.largearc+&quot;,&quot;+attr.sweep+&quot; &quot;+toSVGPair(end);if(attr.sector||attr.closed){st+=&quot; z&quot;}var node=$(elmt.node);node.attr(&quot;d&quot;,st);setStrokeAndFill(node,options);if(options.marker){setMarkers(node,options)}appendSVG(elmt);if(options.label){setLabels([start,end],options)}}function sector(options){if(!options.center||!options.startangle||!options.endangle||!options.radius){return}options.sector=true;arc(options)}function ellipse(center,rx,ry,options){options=options||{};var elmt=getSVGElement(options.id,&quot;ellipse&quot;);center=toSVG(center);var node=$(elmt.node);node.attr(&quot;cx&quot;,center[0]);node.attr(&quot;cy&quot;,center[1]);node.attr(&quot;rx&quot;,rx*SVG.xunitlength);node.attr(&quot;ry&quot;,ry*SVG.yunitlength);setStrokeAndFill(node,options);appendSVG(elmt)}function polygon(list,options){options=options||{};options.closed=true;path(list,options)}function rect(p,q,options){options=options||{};var elmt=getSVGElement(options.id,&quot;rect&quot;);var attr=getOptions([&quot;rx&quot;,&quot;ry&quot;],options);var node=$(elmt.node);node.attr(&quot;x&quot;,toSVG(p)[0]);node.attr(&quot;y&quot;,toSVG(q)[1]);node.attr(&quot;width&quot;,(q[0]-p[0])*SVG.xunitlength);node.attr(&quot;height&quot;,(q[1]-p[1])*SVG.yunitlength);node.attr(&quot;rx&quot;,attr.rx*SVG.xunitlength);node.attr(&quot;ry&quot;,attr.ry*SVG.yunitlength);setStrokeAndFill(node,options);appendSVG(elmt)}function text(p,st,options){options=options||{};var id=options.id;var attr=getOptions([&quot;fontstyle&quot;,&quot;fontfamily&quot;,&quot;fontweight&quot;,&quot;fontfill&quot;,&quot;fontsize&quot;,&quot;fixed&quot;,&quot;pos&quot;],options);if(id&amp;&amp;options.isLabel){id+=options.isLabel}var pos=attr.pos.toUpperCase();if(!attr.fixed){attr.fontsize/=SVG.factor}var elem,node,dx,dy,latex=false,str=$.trim(st.toString()),q=toSVG(p);if(str.charAt(0)==&quot;$&quot;){str=str.substr(1,str.length-2);latex=true}if(latex){if(p[0]&gt;SVG.xmax||p[0]&lt;SVG.xmin||p[1]&gt;SVG.ymax||p[1]&lt;SVG.ymin){return}node=createElementXHTML(&quot;div&quot;);node.style.position=&quot;absolute&quot;;node.style.left=&quot;-1000px&quot;;node.style.top=&quot;-1000px&quot;;$(&quot;body&quot;).append(node);var math=MSVG.parseMath(str,true,attr.fontsize+&quot;px&quot;,attr.fontfill);var mathNode=$(node);mathNode.append($(math).clone());dx=-node.offsetWidth/2;dy=-node.offsetHeight/2;if(/N/.test(pos)){dy=-node.offsetHeight}if(/S/.test(pos)){dy=0}if(/E/.test(pos)){dx=0}if(/W/.test(pos)){dx=-node.offsetWidth}var width=mathNode.width(),height=mathNode.height();mathNode.remove();q[0]+=dx;q[1]+=dy;var elmt=getSVGElement(id,&quot;foreignObject&quot;);elem=$(elmt.node);elem.empty().append(math);elem.attr(&quot;width&quot;,width);elem.attr(&quot;height&quot;,height)}else{var baseline=&quot;middle&quot;,textanchor=&quot;middle&quot;;if(/E/.test(pos)){textanchor=&quot;start&quot;}if(/W/.test(pos)){textanchor=&quot;end&quot;}if(/N/.test(pos)){baseline=&quot;text-after-edge&quot;}if(/S/.test(pos)){baseline=&quot;text-before-edge&quot;}var elmt=getSVGElement(id,&quot;text&quot;);elem=$(elmt.node);elem.empty().text(str);elem.attr(&quot;font-style&quot;,attr.fontstyle);elem.attr(&quot;font-family&quot;,attr.fontfamily);elem.attr(&quot;font-weight&quot;,attr.fontweight);elem.attr(&quot;font-size&quot;,attr.fontsize);elem.attr(&quot;text-anchor&quot;,textanchor);elem.attr(&quot;dominant-baseline&quot;,baseline);setStrokeAndFill(elem,options,&quot;font&quot;)}elem.attr(&quot;x&quot;,q[0]);elem.attr(&quot;y&quot;,q[1]);appendSVG(elmt)}function image(url,options){options=options||{};var elmt=getSVGElement(options.id,&quot;image&quot;);var elem=$(elmt.node);var height=options.height?options.height/SVG.factor:SVG.height;var width=options.width?options.width/SVG.factor:SVG.width;var origin=toSVG(options.origin||[SVG.xmin,SVG.ymin]);var pos=(options.pos||&quot;&quot;).toUpperCase();var x=origin[0]-width*0.5;var y=origin[1]-height*0.5;if(/N/.test(pos)){y-=height*0.5}if(/S/.test(pos)){y+=height*0.5}if(/E/.test(pos)){x+=width*0.5}if(/W/.test(pos)){x-=width*0.5}elem.attr(&quot;x&quot;,x);elem.attr(&quot;y&quot;,y);elem.attr(&quot;width&quot;,width);elem.attr(&quot;height&quot;,height);elem.attr(&quot;preserveAspectRatio&quot;,&quot;none&quot;);elmt.node.setAttributeNS(&quot;http://www.w3.org/1999/xlink&quot;,&quot;xlink:href&quot;,url);appendSVG(elmt)}function grid(options){options=options||{};var dx,dy,x,y,k;var orig=options.origin||[0,0];var id=options.id||&quot;Grid&quot;;options.stroke=options.stroke||&quot;grey&quot;;options.strokewidth=(options.strokewidth||SVG.attr.strokewidth*0.5);var coords=options.coords||SVG.coords;var lim=getScales(options.scales);openGroup(id,true);lim[2]=(typeof lim[2]==&quot;number&quot;)?lim[2]:SVG.ymin;lim[3]=(typeof lim[3]==&quot;number&quot;)?lim[3]:SVG.ymax;if(coords==&quot;polar&quot;){dx=options.dx||1;dy=options.dy||3;var limit=Math.max(Math.abs(lim[0]),Math.abs(lim[1]),Math.abs(lim[2]),Math.abs(lim[3]));for(x=dx;x&lt;limit;x+=dx){circle(orig,x,options)}if(dy&gt;1){for(y=1;y&lt;dy;y++){k=Math.tan(y*Math.PI/(2*dy));line([lim[0],(lim[0]-orig[0])*k+orig[1]],[SVG.xmax,(lim[1]-orig[0])*k+orig[1]],options);line([lim[0],-(lim[0]-orig[0])*k+orig[1]],[SVG.xmax,-(lim[1]-orig[0])*k+orig[1]],options)}}}else{dx=options.dx||1;dy=options.dy||dx;for(x=orig[0];x&lt;SVG.xmax;x+=dx){if(x&gt;lim[0]&amp;&amp;x&lt;lim[1]){line([x,lim[2]],[x,lim[3]],options)}}for(x=orig[0]-dx;x&gt;SVG.xmin;x-=dx){if(x&gt;lim[0]&amp;&amp;x&lt;lim[1]){line([x,lim[2]],[x,lim[3]],options)}}for(y=orig[1];y&lt;SVG.ymax;y+=dy){if(y&gt;lim[2]&amp;&amp;y&lt;lim[3]){line([lim[0],y],[lim[1],y],options)}}for(y=orig[1]-dy;y&gt;SVG.ymin;y-=dy){if(y&gt;lim[2]&amp;&amp;y&lt;lim[3]){line([lim[0],y],[lim[1],y],options)}}}closeGroup()}function axes(options){options=options||{};options.marker=&quot;-|&quot;+(options.marker?options.marker.charAt(0):&quot;-&quot;);var i,x,y,start,stop,label;var dx=options.dx||1;var dy=options.dy||dx;var id=options.id||&quot;Axes&quot;;var fontsize=getOptions(&quot;fontsize&quot;,options);var coords=options.coords||SVG.coords;var orig=(coords==&quot;polar&quot;)?[0,0]:(options.origin||[0,0]);var ddx=options.decx||Math.max(0,-Math.floor(Math.log(dx)/Math.log(10)));var ddy=options.decy||Math.max(0,-Math.floor(Math.log(dy)/Math.log(10)));options.stroke=options.stroke||&quot;black&quot;;options.strokewidth=(options.strokewidth||SVG.attr.strokewidth*0.5);options.markerstroke=options.stroke;options.markerstrokewidth=options.strokewidth;openGroup(id,true);var lim=getScales(options.scales);lim[2]=lim[2]||SVG.ymin;lim[3]=lim[3]||SVG.ymax;if($.isArray(options.xticks)){var xticks=options.xticks.sort();var list2=[[lim[0],orig[1]]];label=[&quot;&quot;];for(i=0;i&lt;xticks.length;i++){list2.push([xticks[i],orig[1]]);label.push(String(xticks[i].toFixed(ddx)))}list2.push([lim[1],orig[1]]);label.push(&quot;&quot;)}else{var list1=[],label1=[];var list2=[],label2=[];start=SVG.xmin+0.25*dx;stop=SVG.xmax-0.25*dx;i=1;var cand,leftExit=0,rightExit=0;while(leftExit*rightExit==0){cand=orig[0]+i*dx;if(cand&gt;start){if(cand&lt;stop){list1.push([cand,orig[1]]);label1.push(String(cand.toFixed(ddx)))}else{rightExit=1}}cand=orig[0]-i*dx;if(cand&lt;stop){if(cand&gt;start){list2.push([cand,orig[1]]);label=(coords==&quot;polar&quot;)?&quot;&quot;:cand.toFixed(ddx);label2.push(String(label))}else{leftExit=1}}i++}list1.push([lim[1],orig[1]]);label1.push(&quot;&quot;);list2.push([lim[0],orig[1]]);label2.push(&quot;&quot;);list2.reverse();list2=list2.concat(list1);label2.reverse();label=label2.concat(label1)}if(options.ticklabels!=false){options.label=label;options.pos=&quot;S&quot;}path(list2,options);if($.isArray(options.yticks)){var yticks=options.yticks.sort();var list2=[[orig[0],lim[2]]];label=[&quot;&quot;];for(i=0;i&lt;yticks.length;i++){list2.push([orig[0],yticks[i]]);label.push(String(yticks[i].toFixed(ddy)))}list2.push([orig[0],lim[3]]);label.push(&quot;&quot;)}else{list1=[],label1=[];list2=[];label2=[];start=SVG.ymin+0.25*dy;stop=SVG.ymax-0.25*dy;i=1;leftExit=0;rightExit=0;while(leftExit*rightExit==0){cand=orig[1]+i*dy;if(cand&gt;start){if(cand&lt;stop){list1.push([orig[0],cand]);label1.push(String(cand.toFixed(ddy)))}else{rightExit=1}}cand=orig[1]-i*dy;if(cand&lt;stop){if(cand&gt;start){list2.push([orig[0],cand]);label=(coords==&quot;polar&quot;)?&quot;&quot;:cand.toFixed(ddy);label2.push(String(label))}else{leftExit=1}}i++}list1.push([orig[0],lim[3]]);label1.push(&quot;&quot;);list2.push([orig[0],lim[2]]);label2.push(&quot;&quot;);list2.reverse();list2=list2.concat(list1);label2.reverse();label=label2.concat(label1)}if(options.ticklabels!=false){options.label=label;options.pos=&quot;W&quot;}options.stroke=options.markerstroke;path(list2,options);closeGroup()}function list(fun,tmin,tmax,options){var inc=(tmax-tmin)/getOptions(&quot;points&quot;,options);if(inc&lt;=0||fun.length==0){return}var t,pth,g=[],xt,yt;for(t=1;t&gt;=0;t--){if($.isFunction(fun[t])){g[t]=fun[t]}else{if(typeof fun[t]==&quot;string&quot;){with(Math){eval(&quot;g[&quot;+t+&quot;] = function(x){return &quot;+fun[t]+&quot;}&quot;)}}else{return}}}if(g.length&lt;2){return}pth=[];for(t=tmin;t&lt;=tmax;t+=inc){xt=g[0](t);yt=g[1](t);if(isFinite(xt)&amp;&amp;isFinite(yt)){pth[pth.length]=[xt,yt]}}return pth}function plot(fun,options){options=options||{};var append,pth,steps=options.steps||[];var n_steps=steps.length;options.closed=false;options.curve=&quot;&quot;;var xmin=(options.min==null)?SVG.xmin:Math.max(SVG.xmin,options.min);var xmax=(options.max==null)?SVG.xmax:Math.min(SVG.xmax,options.max);if(n_steps===0){pth=list([&quot;x&quot;,fun],xmin,xmax,options);if(pth){path(pth,options)}}else{options.id=options.id||Math.randomString(6);steps.sort();var steps_a=[];steps_a.push(xmin);for(i=0;i&lt;n_steps;i++){if(steps[i]&gt;xmin&amp;&amp;steps[i]&lt;xmax){steps_a.push(steps[i])}}steps_a.push(xmax);n_steps=steps_a.length-1;for(i=0;i&lt;n_steps;i++){xmax=steps_a[i+1];xmin=steps_a[i];pth=list([&quot;x&quot;,fun],xmin,xmax,options);append=(i&gt;0);if(pth){path(pth,options,append)}}}}function area(fun1,fun2,options){options=options||{};options.curve=&quot;&quot;;options.closed=true;var xmin=(options.min==null)?SVG.xmin:options.min;var xmax=(options.max==null)?SVG.xmax:options.max;var pth1=list([&quot;x&quot;,fun1],xmin,xmax,options);var pth2=list([&quot;x&quot;,fun2],xmin,xmax,options);if(pth1&amp;&amp;pth2){pth1=pth1.concat(pth2.reverse());path(pth1,options)}}function polarPlot(fun,options){var g1,g2;if(typeof fun==&quot;string&quot;){with(Math){eval(&quot;g1 = function(x){return (&quot;+fun+&quot;)*cos(x)}&quot;);eval(&quot;g2 = function(x){return (&quot;+fun+&quot;)*sin(x)}&quot;)}}else{if($.isFunction(fun)){with(Math){eval(&quot;g1 = function(x){return fun(x)*cos(x)}&quot;);eval(&quot;g2 = function(x){return fun(x)*sin(x)}&quot;)}}}parametricPlot(g1,g2,options)}function parametricPlot(fun1,fun2,options){options=options||{};options.closed=false;options.curve=&quot;&quot;;var xmin=(options.min==null)?0:options.min;var xmax=(options.max==null)?2*Math.PI:options.max;var pth=list([fun1,fun2],xmin,xmax,options);if(pth){path(pth,options)}}function slopeField(fun,options){options=options||{};var g=fun;if(typeof fun==&quot;string&quot;){with(Math){eval(&quot;g = function(x,y){return &quot;+fun+&quot;}&quot;)}}var gxy,x,y,u,v,dz;var dx=(options.dx==null)?1:options.dx;var dy=(options.dy==null)?1:options.dy;dz=Math.sqrt(dx*dx+dy*dy)/6;var xmin=Math.ceil(SVG.xmin/dx);var ymin=Math.ceil(SVG.ymin/dy);for(x=xmin;x&lt;=SVG.xmax;x+=dx){for(y=ymin;y&lt;=SVG.ymax;y+=dy){gxy=g(x,y);if(!isNaN(gxy)){if(Math.abs(gxy)==&quot;Infinity&quot;){u=0;v=dz}else{u=dz/Math.sqrt(1+gxy*gxy);v=gxy*u}line([x-u,y-v],[x+u,y+v],options)}}}}return{showFormulaOnMouseOver:false,latexImages:false,latexConverter:&quot;http://chart.apis.google.com/chart?cht=tx&amp;chs=1x0&amp;chf=bg,s,FFFFFF00&amp;chco=000000&amp;chl=&quot;,mathColor:&quot;&quot;,mathFontSize:&quot;&quot;,mathFontFamily:&quot;&quot;,define:function(oldstr,newstr){if(MSVG.latexImages){return}if((typeof oldstr)==&quot;string&quot;){oldstr=[oldstr];newstr=[newstr]}var i,len=oldstr.length;if(len!=newstr.length){return}for(i=0;i&lt;len;i++){symbols=symbols.concat([{input:&quot;\\&quot;+oldstr[i],tag:&quot;mo&quot;,output:newstr[i],ttype:DEFINITION}])}refreshSymbols()},parseMath:function(str,displaystyle,size,color){if(str===null){return null}str=str.replace(/_([^\{])/gm,&quot;_{$1}&quot;);str=str.replace(/\^([^\{])/gm,&quot;^{$1}&quot;);var frag=parseExpr(str.replace(/^\s+/g,&quot;&quot;),false,false)[0];var node=createMmlNode(&quot;mstyle&quot;,frag);$(node).attr({displaystyle:displaystyle,mathcolor:color||MSVG.mathColor,mathsize:size||MSVG.mathFontSize,fontfamily:MSVG.mathFontFamily});node=createMmlNode(&quot;math&quot;,node);if(MSVG.showFormulaOnMouseOver){$(node).attr({title:str.replace(/\s+/g,&quot; &quot;)})}return node},parseMathExternal:function(str,displaystyle,size,color){if(str===null){return null}var node=createElementXHTML(&quot;img&quot;);var snip=MSVG.latexConverter+str;$(node).attr({src:snip});if(MSVG.showFormulaOnMouseOver){$(node).attr({title:str.replace(/\s+/g,&quot; &quot;)})}return node},generic:function(){if(!$.browser.mozilla){MSVG.latexImages=true}if(MSVG.latexImages){MSVG.parseMath=MSVG.parseMathExternal}else{refreshSymbols()}if(!document.implementation.hasFeature(&quot;http://www.w3.org/TR/SVG11/feature#BasicStructure&quot;,&quot;1.1&quot;)){MSVG.initPictures=MSVG.removePictures}},removePictures:function(obj){var pictures=obj?$(obj):$(&quot;.SVGgraph&quot;);$(pictures).each(function(){var that=$(this);this.id=null;that.empty();that.css({color:&quot;red&quot;,background:&quot;yellow&quot;});that.text(&quot;Missing picture: your  browser does not support inline SVG&quot;);window.setTimeout(function(){that.remove()},10000)})},initPictures:function(obj){var options,scales,qnode,node,node2,status,elem;var pictures=obj?$(obj):$(&quot;.SVGgraph&quot;);$(pictures).each(function(){var that=$(this);status=0;SVG=new pictureObject();options=$(this).attr(&quot;options&quot;);that.removeAttr(&quot;id&quot;);if(options){with(Math){eval(&quot;options={&quot;+options+&quot;}&quot;)}setOptions(options)}else{options={}}if(options.pan==false){SVG.pan=false}SVG.coords=options.coords||SVG.coords;SVG.src=$.trim($(this).text());that.empty();if(typeof options.width==&quot;number&quot;&amp;&amp;options.width&gt;0){SVG.width=options.width;status+=1}if(typeof options.height==&quot;number&quot;&amp;&amp;options.height&gt;0){SVG.height=options.height;status+=2}var scales=getScales(options.scales);SVG.xmin=scales[0];SVG.xmax=scales[1];SVG.ymin=scales[2];SVG.ymax=scales[3];status+=scales[4];SVG.height=options.height;if(status%4!=0){SVG.width=options.width}if(!SVG.width){SVG.width=1.6*SVG.height}else{if(!SVG.height){SVG.height=0.625*SVG.width}}if(status&lt;8){SVG.ymax=0.5*SVG.height*(SVG.xmax-SVG.xmin)/SVG.width;SVG.ymin=-SVG.ymax}else{if(status&lt;12){SVG.xmax=0.5*SVG.width*(SVG.ymax-SVG.ymin)/SVG.height;SVG.xmin=-SVG.xmax}}if(status==12||status==13){SVG.height=SVG.width*(SVG.ymax-SVG.ymin)/(SVG.xmax-SVG.xmin)}else{if(status==14){SVG.width=SVG.height*(SVG.xmax-SVG.xmin)/(SVG.ymax-SVG.ymin)}}SVG.id=options.id||Math.randomString(16);qnode=createSVGElement(&quot;svg&quot;);elem=$(qnode);qnode.id=SVG.id;elem.attr(&quot;xmlns&quot;,&quot;http://www.w3.org/2000/svg&quot;);elem.attr(&quot;xmlns:ev&quot;,&quot;http://www.w3.org/2001/xml-events&quot;);elem.attr(&quot;xmlns:xlink&quot;,&quot;http://www.w3.org/1999/xlink&quot;);elem.attr(&quot;version&quot;,&quot;1.1&quot;);elem.attr(&quot;baseProfile&quot;,&quot;full&quot;);if(options.border){elem.attr(&quot;style&quot;,&quot;border:&quot;+options.border)}node=createSVGElement(&quot;clipPath&quot;);node.id=SVG.id+&quot;ClipPath&quot;;node2=createSVGElement(&quot;path&quot;);$(node).append(node2);elem.attr(&quot;clip-path&quot;,&quot;url(#&quot;+SVG.id+&quot;ClipPath)&quot;);node2=createSVGElement(&quot;defs&quot;);node2.id=SVG.id+&quot;_Defs&quot;;$(node2).append(node);$(qnode).append(node2);node2=createSVGElement(&quot;g&quot;);node2.id=SVG.id+&quot;_Canvas&quot;;$(qnode).append(node2);that.append(qnode);this.style.position=&quot;relative&quot;;if(!(this.nodeName==&quot;SPAN&quot;)){setAction(&quot;mousemove&quot;,updatePosition);if(SVG.pan){setAction(&quot;mouseup&quot;,onDrop)}if(window.addEventListener){var evt=$.browser.mozilla?&quot;DOMMouseScroll&quot;:&quot;mousewheel&quot;;qnode.addEventListener(evt,onWheel,false)}}setAction(&quot;mousedown&quot;,onClick);setAction(&quot;mouseover&quot;,switchTo);canvas=$(&quot;#&quot;+SVG.id+&quot;_Canvas&quot;)[0];resize(1)});if(pictures.length&gt;0&amp;&amp;$(&quot;#SVGtoolbar&quot;).length===0){node=createElementXHTML(&quot;span&quot;);node.id=&quot;SVGtoolbar&quot;;node.style.position=&quot;absolute&quot;;node.style.textAlign=&quot;left&quot;;node.style.zIndex=10;node=addButton(node,&quot;X&quot;,&quot;Close editor&quot;,closeEditor);node=addButton(node,&quot;Update&quot;,&quot;Update picture&quot;,updateButton,&quot;SVGupdateButton&quot;);node=addButton(node,&quot;SVG&quot;,&quot;View SVG code&quot;,exportSVG);node=addButton(node,&quot;-&quot;,&quot;Zoom out&quot;,function(){zoom(1.25,true)});node=addButton(node,&quot;+&quot;,&quot;Zoom in&quot;,function(){zoom(0.8,true)});node=addButton(node,&quot;\u2191&quot;,&quot;Enlarge picture&quot;,function(){resize(0.8)});node=addButton(node,&quot;\u2193&quot;,&quot;Reduce picture&quot;,function(){resize(1.25)});$(node).append(&quot;&lt;br /&gt;&quot;);node2=createElementXHTML(&quot;textarea&quot;);$(node2).attr({id:&quot;SVGsrc&quot;,rows:8,cols:60});$(node).append(node2);$(node).hide();$(&quot;body&quot;).append(node)}}}}(jQuery);
//}}}
/***
!~TiddlyWiki formatters
***/
//{{{
if(!version.extensions.MathSVGPlugin) { //# ensure that the plugin is only installed once
version.extensions.MathSVGPlugin = {installed: true};
MSVG.generic();

config.formatterHelpers.MathSVGHelper = function(w) {
  if(MSVG.noMathTag &amp;&amp; jQuery.inArray(MSVG.noMathTag,w.tiddler.tags)&gt;-1) return;
  this.lookaheadRegExp.lastIndex = w.matchStart;
  var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
  if(lookaheadMatch){
    var eq = MSVG.parseMath(lookaheadMatch[1],this.displaystyle);
    if(this.displaystyle){
      var node = createTiddlyElement(w.output,&quot;div&quot;);
      node.style.textAlign='center';
      node.appendChild(eq);
      w.output.appendChild(node);
    } else {w.output.appendChild(eq);}
    w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
  }
}

config.formatters.push( {
  name: &quot;clatex&quot;,
  match: &quot;\\$\\$&quot;,
  lookaheadRegExp: /\$\$((?:.|\n)*?)\$\$/mg,
  displaystyle: true,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: &quot;clatex2&quot;,
  match: &quot;\\\\\\\[&quot;,
  lookaheadRegExp: /\\\[((?:.|\n)*?)\\\]/mg,
  displaystyle: true,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: &quot;latex&quot;,
  match: &quot;\\$&quot;,
  lookaheadRegExp: /\$((?:.|\n)*?)\$/mg,
  displaystyle: false,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: &quot;latex2&quot;,
  match: &quot;\\\\\\\(&quot;,
  lookaheadRegExp: /\\\(((?:.|\n)*?)\\\)/mg,
  displaystyle: false,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: &quot;graph&quot;,
  match: &quot;&lt;div&quot;,
  lookaheadRegExp: /&lt;div.+SVGgraph.+?&gt;((?:.|\n)*?)&lt;\/div&gt;/mg,
  handler: function(w){
    if(MSVG.noSvgTag &amp;&amp; jQuery.inArray(MSVG.noSvgTag,w.tiddler.tags)&gt;-1) return;
    this.lookaheadRegExp.lastIndex = w.matchStart;
    var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
    if(lookaheadMatch){
      var text = lookaheadMatch[0].replace('&lt;div','&lt;div id=&quot;currentGraph&quot;');
      jQuery(w.output).append(text);
      MSVG.initPictures(&quot;#currentGraph&quot;);
      w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
    }
  }
})

config.formatters.push( {
  name: &quot;inlineGraph&quot;,
  match: &quot;&lt;span&quot;,
  lookaheadRegExp: /&lt;span.+SVGgraph.+?&gt;((?:.|\n)*?)&lt;\/span&gt;/mg,
  handler: function(w){
    if(MSVG.noSvgTag &amp;&amp; jQuery.inArray(MSVG.noSvgTag,w.tiddler.tags)&gt;-1) return;
    this.lookaheadRegExp.lastIndex = w.matchStart;
    var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
    if(lookaheadMatch){
      var text = lookaheadMatch[0].replace('&lt;span','&lt;span id=&quot;currentGraph&quot;');
      jQuery(w.output).append(text);
      MSVG.initPictures(&quot;#currentGraph&quot;);
      w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
    }
  }
})

}
//}}}</pre>
</div>
<div title="MessageLogPlugin" modifier="escdie" created="201010171910" modified="201011101812" tags="systemConfig plugin %tw-elnb">
<pre>/***
|Name|MessageLogPlugin|
|Source|http://www.TiddlyTools.com/#MessageLogPlugin|
|Documentation|http://www.TiddlyTools.com/#MessageLogPlugin|
|Version|1.0.2|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.4|
|Type|plugin|
|Description|automatically log TW messages to a [[MessageLog]] tiddler|
This plugin uses a tiddler to store the text/link for each message that is displayed during a TiddlyWiki session.
!!!!!Documentation
&lt;&lt;&lt;
By default, messages displayed by TiddlyWiki are not retained once they are dismissed from the display.  This plugin automatically appends each message to a //shadow// tiddler, [[MessageLog]], to provide a short-term, per-session record of messages without altering any 'real' tiddlers in your document.

You can view the [[MessageLog]] tiddler at any time to review the previous messages and, if you convert the shadow tiddler to a 'real' tiddler (by editing it), then any subsequent messages will be added to both that real tiddler and the automatic shadow log.  This real tiddler will, of course, be saved with the rest of your TW document when you save the file, allowing you to keep a persistent, inter-session log rather than a short-term, per-session log.
&lt;&lt;&lt;
!!!!!Configuration
&lt;&lt;&lt;
&lt;&lt;option chkMessageLog&gt;&gt; enable automatic logging of messages in: {{editor{&lt;&lt;option txtMessageLogName&gt;&gt;}}}
Date format (for log entries): {{editor{&lt;&lt;option txtMessageLogDateFormat&gt;&gt;}}}
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2008.12.24 [1.0.2] hijack getMessageDiv() to add 'view log' command to message box
2008.12.23 [1.0.1] defined ResetMessageLogCommand section and embedded command in default shadow message log.  Also, prevent refresh of log display if tiddler is currently being edited.
2008.12.23 [1.0.0] initial release
&lt;&lt;&lt;
!!!!!MessageLogControls
&lt;&lt;option chkMessageLog&gt;&gt; enable logging | &lt;html&gt;&lt;a href='javascript:;' title='Delete message log tiddler AND clear automatic shadow log' onclick='var log=config.options.txtMessageLogName; if (!confirm(this.title+&quot;?&quot;)) return false; config.shadowTiddlers[log]=&quot;\&lt;\&lt;tiddler [[MessageLogPlugin##MessageLogControls]]\&gt;\&gt;\n&quot;; store.removeTiddler(log); story.refreshTiddler(log,null,true);'&gt;clear message log&lt;/a&gt;&lt;/html&gt;
!!!!!Code
***/
//{{{
version.extensions.MessageLogPlugin= {major: 1, minor: 0, revision: 2, date: new Date(2008,12,24)};

// SETTINGS
if (config.options.chkMessageLog===undefined)
	config.options.chkMessageLog=true;
if (config.options.txtMessageLogName===undefined)
	config.options.txtMessageLogName='MessageLog';
if (config.options.txtMessageLogDateFormat===undefined)
	config.options.txtMessageLogDateFormat='YYYY.0MM.0DD 0hh:0mm:0ss';

// SHADOW LOG
config.shadowTiddlers[config.options.txtMessageLogName]=
	'&lt;&lt;tiddler [[MessageLogPlugin##MessageLogControls]]&gt;&gt;\n'

if (window.displayMessage_MessageLogHijack===undefined) { // only once
	window.displayMessage_MessageLogHijack=window.displayMessage;
	window.displayMessage=function(text,linkText) {
		this.displayMessage_MessageLogHijack.apply(this,arguments);
		if (!config.options.chkMessageLog) return;
		var log=config.options.txtMessageLogName;
		var fmt='&gt;%0 '+(linkText?'[[%1|%2]]':'%1');
		var now=new Date().formatString(config.options.txtMessageLogDateFormat);
		var cmd='&lt;&lt;tiddler [[MessageLogPlugin##MessageLogControls]]&gt;&gt;\n';
		var out=store.getTiddlerText(log,cmd)+fmt.format([now,text,linkText])+'\n';
		config.shadowTiddlers[log]=out; // update shadow log
		var tid=store.getTiddler(log); if (tid) { // update real tiddler log, if present
			var who=config.options.chkForceMinorUpdate?tid.modifier:config.options.txtUserName;
			var when=config.options.chkForceMinorUpdate?tid.modified:new Date();
			store.saveTiddler(log,log,out,who,when,tid.tags,tid.fields);
		}
		if (!story.isDirty(log)) story.refreshTiddler(log,null,true); // only if log is not being edited
	}
}

if (window.getMessageDiv_MessageLogHijack===undefined) { // only once
	window.getMessageDiv_MessageLogHijack=window.getMessageDiv;
	window.getMessageDiv=function() { // add 'view log' command to message box
		var msgArea=document.getElementById(&quot;messageArea&quot;); if(!msgArea) return null;
		var addLogBtn=!msgArea.hasChildNodes();
		var r=this.getMessageDiv_MessageLogHijack.apply(this,arguments);
		if(addLogBtn) {
			createTiddlyText(msgArea.firstChild,'|');
			createTiddlyButton(msgArea.firstChild,'log','view '+config.options.txtMessageLogName,
				function(ev) { story.displayTiddler(null,config.options.txtMessageLogName); });
		}
		return r;
	}
}
//}}}</pre>
</div>
<div title="ReminderMacros" modifier="dger" created="201007171358" modified="201010240511" tags="systemConfig %extension macro macroInfo %tw-elnb RemainderPackage">
<pre>/***
|''Name:''|ReminderPlugin|
|''Version:''|2.3.10 (Jun 28, 2007)|
|''Source:''|http://remindermacros.tiddlyspot.com|
|''Author:''|Jeremy Sheeley(pop1280 [at] excite [dot] com)&lt;br&gt;Maintainer: simon.baird@gmail.com|
|''Licence:''|[[BSD open source license]]|
|''Macros:''|reminder, showreminders, displayTiddlersWithReminders, newReminder|
|''TiddlyWiki:''|2.0+|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|

!Description
This plugin provides macros for tagging a date with a reminder.  Use the {{{reminder}}} macro to do this.  The {{{showReminders}}} and {{{displayTiddlersWithReminder}}} macros automatically search through all available tiddlers looking for upcoming reminders.

!Installation
* Create a new tiddler in your tiddlywiki titled ReminderPlugin and give it the {{{systemConfig}}} tag.  The tag is important because it tells TW that this is executable code.
* Double click this tiddler, and copy all the text from the tiddler's body.
* Paste the text into the body of the new tiddler in your TW.
* Save and reload your TW.
* You can copy some examples into your TW as well.  See [[Simple examples]], [[Holidays]], [[showReminders]] and [[Personal Reminders]]

!Syntax:
|&gt;|See [[ReminderSyntax]] and [[showRemindersSyntax]]|

!Revision history
* v2.3.10 (Jun 28, 2007)
** Removed window.story = window backwards compatibility hacks since they were breaking TW 2.2
* v2.3.9 (Apr 26, 2007)
** allow bracketed list format in tags param lets you use tags with spaces
* v2.3.8 (Mar 9, 2006)
**Bug fix: A global variable had snuck in, which was killing FF 1.5.0.1
**Feature: You can now use TIDDLER and TIDDLERNAME in a regular reminder format
* v2.3.6 (Mar 1, 2006)
**Bug fix: Reminders for today weren't being matched sometimes.
**Feature:  Solidified integration with DatePlugin and CalendarPlugin
**Feature:  Recurring reminders will now return multiple hits in showReminders and the calendar.
**Feature:  Added TIDDLERNAME to the replacements for showReminders format, for plugins that need the title without brackets.
* v2.3.5 (Feb 8, 2006)
**Bug fix: Sped up reminders lots.  Added a caching mechanism for reminders that have already been matched.
* v2.3.4 (Feb 7, 2006)
**Bug fix: Cleaned up code to hopefully prevent the Firefox 1.5.0.1 crash that was causing lots of plugins 
to crash Firefox.  Thanks to http://www.jslint.com
* v2.3.3 (Feb 2, 2006)
**Feature: newReminder now has drop down lists instead of text boxes.
**Bug fix:  A trailing space in a title would trigger an infinite loop.
**Bug fix:  using tag:&quot;birthday !reminder&quot; would filter differently than tag:&quot;!reminder birthday&quot;
* v2.3.2 (Jan 21, 2006)
**Feature: newReminder macro, which will let you easily add a reminder to a tiddler. Thanks to Eric Shulman (http://www.elsdesign.com) for the code to do this.
** Bug fix: offsetday was not working sometimes
** Bug fix: when upgrading to 2.0, I included a bit to exclude tiddlers tagged with excludeSearch.  I've reverted back to searching through all tiddlers
* v2.3.1 (Jan 7, 2006)
**Feature: 2.0 compatibility
**Feature AlanH sent some code to make sure that showReminders prints a message if no reminders are found.
* v2.3.0 (Jan 3, 2006)
** Bug Fix:  Using &quot;Last Sunday (-0)&quot; as a offsetdayofweek wasn't working.
** Bug Fix:  Daylight Savings time broke offset based reminders (for example year:2005 month:8 day:23 recurdays:7 would match Monday instead of Tuesday during DST.

!Code
***/
//{{{

//============================================================================
//============================================================================
//           ReminderPlugin
//============================================================================
//============================================================================

version.extensions.ReminderPlugin = {major: 2, minor: 3, revision: 8, date: new Date(2006,3,9), source: &quot;http://remindermacros.tiddlyspot.com/&quot;};

//============================================================================
// Configuration
// Modify this section to change the defaults for 
// leadtime and display strings
//============================================================================

config.macros.reminders = {};
config.macros[&quot;reminder&quot;] = {};
config.macros[&quot;newReminder&quot;] = {};
config.macros[&quot;showReminders&quot;] = {};
config.macros[&quot;displayTiddlersWithReminders&quot;] = {};

config.macros.reminders[&quot;defaultLeadTime&quot;] = [0,6000];
config.macros.reminders[&quot;defaultReminderMessage&quot;] = &quot;DIFF: TITLE on DATE ANNIVERSARY&quot;;
config.macros.reminders[&quot;defaultShowReminderMessage&quot;] = &quot;DIFF: TITLE on DATE ANNIVERSARY -- TIDDLER&quot;;
config.macros.reminders[&quot;defaultAnniversaryMessage&quot;] = &quot;(DIFF)&quot;;
config.macros.reminders[&quot;untitledReminder&quot;] = &quot;Untitled Reminder&quot;;
config.macros.reminders[&quot;noReminderFound&quot;] = &quot;Couldn't find a match for TITLE in the next LEADTIMEUPPER days.&quot;
config.macros.reminders[&quot;todayString&quot;] = &quot;Today&quot;;
config.macros.reminders[&quot;tomorrowString&quot;] = &quot;Tomorrow&quot;;
config.macros.reminders[&quot;ndaysString&quot;] = &quot;DIFF days&quot;;
config.macros.reminders[&quot;emtpyShowRemindersString&quot;] = &quot;There are no upcoming events&quot;;


//============================================================================
//  Code
// You should not need to edit anything 
// below this.  Make sure to edit this tiddler and copy 
// the code from the text box, to make sure that 
// tiddler rendering doesn't interfere with the copy 
// and paste.
//============================================================================

//this object will hold the cache of reminders, so that we don't
//recompute the same reminder over again.
var reminderCache = {};

config.macros.showReminders.handler = function showReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash[&quot;year&quot;] != null) || 
			(paramHash[&quot;month&quot;] != null) || 
			(paramHash[&quot;day&quot;] != null) || 
			(paramHash[&quot;dayofweek&quot;] != null);
   if (paramHash[&quot;leadtime&quot;] != null)
   {
      leadtime = paramHash[&quot;leadtime&quot;];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the 
         //leadtime a few lines down.
         paramHash[&quot;leadtime&quot;] = [-10000, 10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash[&quot;leadtime&quot;][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash[&quot;leadtime&quot;][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }

   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash[&quot;tag&quot;], paramHash[&quot;limit&quot;]);
   var elem = createTiddlyElement(place,&quot;span&quot;,null,null, null);
   var mess = &quot;&quot;;
   if (arr.length == 0)
   {
      mess += config.macros.reminders.emtpyShowRemindersString; 
   }
   for (var j = 0; j &lt; arr.length; j++)
   {
      if (paramHash[&quot;format&quot;] != null)
      {
         arr[j][&quot;params&quot;][&quot;format&quot;] = paramHash[&quot;format&quot;];
      }
      else
      {
         arr[j][&quot;params&quot;][&quot;format&quot;] = config.macros.reminders[&quot;defaultShowReminderMessage&quot;];
      }
      mess += getReminderMessageForDisplay(arr[j][&quot;diff&quot;], arr[j][&quot;params&quot;], arr[j][&quot;matchedDate&quot;], arr[j][&quot;tiddler&quot;]);
      mess += &quot;\n&quot;;
   }
   wikify(mess, elem, null, null);
};


config.macros.displayTiddlersWithReminders.handler = function displayTiddlersWithReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash[&quot;year&quot;] != null) || 
			(paramHash[&quot;month&quot;] != null) || 
			(paramHash[&quot;day&quot;] != null) || 
			(paramHash[&quot;dayofweek&quot;] != null);
   if (paramHash[&quot;leadtime&quot;] != null)
   {
      leadtime = paramHash[&quot;leadtime&quot;];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the leadtime 
         //a few lines down.
         paramHash[&quot;leadtime&quot;] = [-10000,10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash[&quot;leadtime&quot;][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash[&quot;leadtime&quot;][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }
   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash[&quot;tag&quot;], paramHash[&quot;limit&quot;]);
   for (var j = 0; j &lt; arr.length; j++)
   {
      displayTiddler(null, arr[j][&quot;tiddler&quot;], 0, null, false, false, false);
   }
};

config.macros.reminder.handler = function reminder(place,macroName,params)
{
   var dateHash = getParamsForReminder(params);
   if (dateHash[&quot;hidden&quot;] != null)
   {
      return;
   }
   var leadTime = dateHash[&quot;leadtime&quot;];
   if (leadTime == null)
   {
      leadTime = config.macros.reminders[&quot;defaultLeadTime&quot;]; 
   }
   var leadTimeLowerBound = new Date().getMidnight().addDays(leadTime[0]);
   var leadTimeUpperBound = new Date().getMidnight().addDays(leadTime[1]);
   var matchedDate = findDateForReminder(dateHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound);
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(place).id.substr(7);
   if (matchedDate != null)
   {
      var diff = matchedDate.getDifferenceInDays(new Date().getMidnight());
      var elem = createTiddlyElement(place,&quot;span&quot;,null,null, null);
      var mess = getReminderMessageForDisplay(diff, dateHash, matchedDate, title);
      wikify(mess, elem, null, null);
   }
   else
   {
      createTiddlyElement(place,&quot;span&quot;,null,null, config.macros.reminders[&quot;noReminderFound&quot;].replace(&quot;TITLE&quot;, dateHash[&quot;title&quot;]).replace(&quot;LEADTIMEUPPER&quot;, leadTime[1]).replace(&quot;LEADTIMELOWER&quot;, leadTime[0]).replace(&quot;TIDDLERNAME&quot;, title).replace(&quot;TIDDLER&quot;, &quot;[[&quot; + title + &quot;]]&quot;) );
   }
};

config.macros.newReminder.handler = function newReminder(place,macroName,params)
{
  var today=new Date().getMidnight();
  var formstring = '&lt;html&gt;&lt;form&gt;Year: &lt;select name=&quot;year&quot;&gt;&lt;option value=&quot;&quot;&gt;Every year&lt;/option&gt;';
  for (var i = 0; i &lt; 5; i++)
  {
    formstring += '&lt;option' + ((i == 0) ? ' selected' : '') + ' value=&quot;' + (today.getFullYear() +i) + '&quot;&gt;' + (today.getFullYear() + i) + '&lt;/option&gt;';
  }
  formstring += '&lt;/select&gt;&amp;nbsp;&amp;nbsp;Month:&lt;select name=&quot;month&quot;&gt;&lt;option value=&quot;&quot;&gt;Every month&lt;/option&gt;';
  for (i = 0; i &lt; 12; i++)
  {
    formstring += '&lt;option' + ((i == today.getMonth()) ? ' selected' : '') + ' value=&quot;' + (i+1) + '&quot;&gt;' + config.messages.dates.months[i] + '&lt;/option&gt;';
  }
  formstring += '&lt;/select&gt;&amp;nbsp;&amp;nbsp;Day:&lt;select name=&quot;day&quot;&gt;&lt;option value=&quot;&quot;&gt;Every day&lt;/option&gt;';
  for (i = 1; i &lt; 32; i++)
  {
    formstring += '&lt;option' + ((i == (today.getDate() )) ? ' selected' : '') + ' value=&quot;' + i + '&quot;&gt;' + i + '&lt;/option&gt;';
  }

formstring += '&lt;/select&gt;&amp;nbsp;&amp;nbsp;Reminder Title:&lt;input type=&quot;text&quot; size=&quot;40&quot; name=&quot;title&quot; value=&quot;please enter a title&quot; onfocus=&quot;this.select();&quot;&gt;&lt;input type=&quot;button&quot; value=&quot;ok&quot; onclick=&quot;addReminderToTiddler(this.form)&quot;&gt;&lt;/form&gt;&lt;/html&gt;';

  var panel = config.macros.slider.createSlider(place,null,&quot;New Reminder&quot;,&quot;Open a form to add a new reminder to this tiddler&quot;);
  wikify(formstring ,panel,null,store.getTiddler(params[1]));
};

// onclick: process input and insert reminder at 'marker'
window.addReminderToTiddler = function(form) {
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(form).id.substr(7);
   var tiddler=store.getTiddler(title);
  var txt='\n&lt;&lt;reminder ';
  if (form.year.value != &quot;&quot;)
    txt += 'year:'+form.year.value + ' ';
  if (form.month.value != &quot;&quot;)
    txt += 'month:'+form.month.value + ' ';
  if (form.day.value != &quot;&quot;)
    txt += 'day:'+form.day.value + ' ';
  txt += 'title:&quot;'+form.title.value+'&quot; ';
  txt +='&gt;&gt;';
   tiddler.set(null,tiddler.text + txt);
   window.story.refreshTiddler(title,1,true);
   store.setDirty(true);
};

function hasTag(tiddlerTags, tagFilters)
{
  //Make sure we respond well to empty tiddlerTaglists or tagFilterlists
  if (tagFilters.length==0 || tiddlerTags.length==0)
  {
    return true;
  }

  var bHasTag = false;
  
  /*bNoPos says: &quot;'till now there has been no check using a positive filter&quot;
     Imagine a filterlist consisting of 1 negative filter:
         If the filter isn't matched, we want hasTag to be true.
         Yet bHasTag is still false ('cause only positive filters cause bHasTag to change)
         
     If no positive filters are present bNoPos is true, and no negative filters are matched so we have not returned false
         Thus: hasTag returns true.
      
      If at any time a positive filter is encountered, we want at least one of the tags to match it, so we turn bNoPos to false, which
      means bHasTag must be true for hasTag to return true*/
  var bNoPos=true;
  
for (var t3 = 0; t3 &lt; tagFilters.length; t3++)
  {
      for(var t2=0; t2&lt;tiddlerTags.length; t2++)
      {
           if (tagFilters[t3].length &gt; 1 &amp;&amp; tagFilters[t3].charAt(0) == '!') 
           {
              if (tiddlerTags[t2] == tagFilters[t3].substring(1))
              {
                 //If at any time a negative filter is matched, we return false
                  return false;
              }
           }
           else 
           {
              if (bNoPos)
              {
                 //We encountered the first positive filter
                 bNoPos=false;
              }
              if (tiddlerTags[t2] == tagFilters[t3])
              {
                  //A positive filter is matched. As long as no negative filter is matched, hasTag will return true
                  bHasTag=true;
              }
           }
        }
    }
    return (bNoPos || bHasTag);
};

//This function searches all tiddlers for the reminder  //macro.  It is intended that other plugins (like //calendar) will use this function to query for 
//upcoming reminders.
//The arguments to this function filter out reminders //based on when they will fire.
//
//ARGUMENTS:
//baseDate is the date that is used as &quot;now&quot;.  
//leadtime is a two element int array, with leadtime[0] 
//         as the lower bound and leadtime[1] as the
//         upper bound.  A reasonable default is [0,14]
//tags is a space-separated list of tags to use to filter 
//         tiddlers.  If a tag name begins with an !, then 
//         only tiddlers which do not have that tag will 
//         be considered.  For example &quot;examples holidays&quot;  
//         will search for reminders in any tiddlers that  
//         are tagged with examples or holidays and 
//         &quot;!examples !holidays&quot; will search for reminders 
//         in any tiddlers that are not tagged with 
//         examples or holidays.  Pass in null to search 
//         all tiddlers.
//limit.  If limit is null, individual reminders can 
//        override the leadtime specified earlier.  
//        Pass in 1 in order to override that behavior.

window.findTiddlersWithReminders = function findTiddlersWithReminders(baseDate, leadtime, tags, limit)
{
//function(searchRegExp,sortField,excludeTag)
//   var macroPattern = &quot;&lt;&lt;([^&gt;\\]+)(?:\\*)([^&gt;]*)&gt;&gt;&quot;;
   var macroPattern = &quot;&lt;&lt;(reminder)(.*)&gt;&gt;&quot;;
   var macroRegExp = new RegExp(macroPattern,&quot;mg&quot;);
   var matches = store.search(macroRegExp,&quot;title&quot;,&quot;&quot;);
   var arr = [];
   var tagsArray = null;
   if (tags != null)
   {
      // tagsArray = tags.split(&quot; &quot;);
      tagsArray = tags.readBracketedList(); // allows tags with spaces. thanks Robin Summerhill, 4-Oct-06.
   }
   for(var t=matches.length-1; t&gt;=0; t--)
   {
      if (tagsArray != null)
      {
         //If they specified tags to filter on, and this tiddler doesn't 
	 //match, skip it entirely.
         if ( ! hasTag(matches[t].tags, tagsArray))
         {
            continue;
         }
      }

      var targetText = matches[t].text;
      do {
         // Get the next formatting match
         var formatMatch = macroRegExp.exec(targetText);
         if(formatMatch &amp;&amp; formatMatch[1] != null &amp;&amp; formatMatch[1].toLowerCase() == &quot;reminder&quot;)
         {
            //Find the matching date.
            
            var params = formatMatch[2] != null ? formatMatch[2].readMacroParams() : {};
            var dateHash = getParamsForReminder(params);
            if (limit != null || dateHash[&quot;leadtime&quot;] == null)
            {
               if (leadtime == null)
                   dateHash[&quot;leadtime&quot;] = leadtime;
               else
               {
                  dateHash[&quot;leadtime&quot;] = [];
                  dateHash[&quot;leadtime&quot;][0] = leadtime[0];
                  dateHash[&quot;leadtime&quot;][1] = leadtime[1];
               }
            }
	    if (dateHash[&quot;leadtime&quot;] == null)
               dateHash[&quot;leadtime&quot;] = config.macros.reminders[&quot;defaultLeadTime&quot;]; 
            var leadTimeLowerBound = baseDate.addDays(dateHash[&quot;leadtime&quot;][0]);
            var leadTimeUpperBound = baseDate.addDays(dateHash[&quot;leadtime&quot;][1]);
            var matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
            while (matchedDate != null)
            {
               var hash = {};
               hash[&quot;diff&quot;] = matchedDate.getDifferenceInDays(baseDate);
               hash[&quot;matchedDate&quot;] = new Date(matchedDate.getFullYear(), matchedDate.getMonth(), matchedDate.getDate(), 0, 0);
               hash[&quot;params&quot;] = cloneParams(dateHash);
               hash[&quot;tiddler&quot;] = matches[t].title;
               hash[&quot;tags&quot;] = matches[t].tags;
               arr.pushUnique(hash);
	       if (dateHash[&quot;recurdays&quot;] != null || (dateHash[&quot;year&quot;] == null))
	       {
	         leadTimeLowerBound = leadTimeLowerBound.addDays(matchedDate.getDifferenceInDays(leadTimeLowerBound)+ 1);
                 matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
	       }
	       else matchedDate = null;
            }
         }
      }while(formatMatch);
   }
   if(arr.length &gt; 1)  //Sort the array by number of days remaining.
   {
      arr.sort(function (a,b) {if(a[&quot;diff&quot;] == b[&quot;diff&quot;]) {return(0);} else {return (a[&quot;diff&quot;] &lt; b[&quot;diff&quot;]) ? -1 : +1; } });
   }
   return arr;
};

//This function takes the reminder macro parameters and
//generates the string that is used for display.
//This function is not intended to be called by 
//other plugins.
 window.getReminderMessageForDisplay= function getReminderMessageForDisplay(diff, params, matchedDate, tiddlerTitle)
{
   var anniversaryString = &quot;&quot;;
   var reminderTitle = params[&quot;title&quot;];
   if (reminderTitle == null)
   {
      reminderTitle = config.macros.reminders[&quot;untitledReminder&quot;];
   }
   if (params[&quot;firstyear&quot;] != null)
   {
      anniversaryString = config.macros.reminders[&quot;defaultAnniversaryMessage&quot;].replace(&quot;DIFF&quot;, (matchedDate.getFullYear() - params[&quot;firstyear&quot;]));
   }
   var mess = &quot;&quot;;
   var diffString = &quot;&quot;;
   if (diff == 0)
   {
      diffString = config.macros.reminders[&quot;todayString&quot;];
   }
   else if (diff == 1)
   {
      diffString = config.macros.reminders[&quot;tomorrowString&quot;];
   }
   else
   {
      diffString = config.macros.reminders[&quot;ndaysString&quot;].replace(&quot;DIFF&quot;, diff);
   }
   var format = config.macros.reminders[&quot;defaultReminderMessage&quot;];
   if (params[&quot;format&quot;] != null)
   {
      format = params[&quot;format&quot;];
   }
   mess = format;
//HACK!  -- Avoid replacing DD in TIDDLER with the date
   mess = mess.replace(/TIDDLER/g, &quot;TIDELER&quot;);
   mess = matchedDate.formatStringDateOnly(mess);
   mess = mess.replace(/TIDELER/g, &quot;TIDDLER&quot;);
   if (tiddlerTitle != null)
   {
      mess = mess.replace(/TIDDLERNAME/g, tiddlerTitle);
      mess = mess.replace(/TIDDLER/g, &quot;[[&quot; + tiddlerTitle + &quot;]]&quot;);
   }
   
   mess = mess.replace(&quot;DIFF&quot;, diffString).replace(&quot;TITLE&quot;, reminderTitle).replace(&quot;DATE&quot;, matchedDate.formatString(&quot;DDD MMM DD, YYYY&quot;)).replace(&quot;ANNIVERSARY&quot;, anniversaryString);
   return mess;
};

// Parse out the macro parameters into a hashtable.  This
// handles the arguments for reminder, showReminders and 
// displayTiddlersWithReminders.
window.getParamsForReminder = function getParamsForReminder(params)
{
   var dateHash = {};
   var type = &quot;&quot;;
   var num = 0;
   var title = &quot;&quot;;
   for(var t=0; t&lt;params.length; t++)
   {
      var split = params[t].split(&quot;:&quot;);
      type = split[0].toLowerCase();
      var value = split[1];
      for (var i=2; i &lt; split.length; i++)
      {
         value += &quot;:&quot; + split[i];
      }
      if (type == &quot;nolinks&quot; || type == &quot;limit&quot; || type == &quot;hidden&quot;)
      {
         num = 1;
      }
      else if (type == &quot;leadtime&quot;)
      {
         var leads = value.split(&quot;...&quot;);
         if (leads.length == 1)
         {
            leads[1]= leads[0];
            leads[0] = 0;
         }
         leads[0] = parseInt(leads[0], 10);
         leads[1] = parseInt(leads[1], 10);
         num = leads;
      }
      else if (type == &quot;offsetdayofweek&quot;)
      {
          if (value.substr(0,1) == &quot;-&quot;)
          {
             dateHash[&quot;negativeOffsetDayOfWeek&quot;] = 1;
	     value = value.substr(1);
          }
          num = parseInt(value, 10);
      }
      else if (type != &quot;title&quot; &amp;&amp; type != &quot;tag&quot; &amp;&amp; type != &quot;format&quot;)
      {
         num = parseInt(value, 10);
      }
      else
      {
         title = value;
         t++;
         while (title.substr(0,1) == '&quot;' &amp;&amp; title.substr(title.length - 1,1) != '&quot;' &amp;&amp; params[t] != undefined)
         {
            title += &quot; &quot; + params[t++];
         }
         //Trim off the leading and trailing quotes
         if (title.substr(0,1) == &quot;\&quot;&quot; &amp;&amp; title.substr(title.length - 1,1)== &quot;\&quot;&quot;)
         {
            title = title.substr(1, title.length - 2);
            t--;
         }
         num = title;
      }
      dateHash[type] = num;
   }
   //date is synonymous with day
   if (dateHash[&quot;day&quot;] == null)
   {
      dateHash[&quot;day&quot;] = dateHash[&quot;date&quot;];
   }
   return dateHash;
};

//This function finds the date specified in the reminder 
//parameters.  It will return null if no match can be
//found.  This function is not intended to be used by
//other plugins.
window.findDateForReminder= function findDateForReminder( dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound)
{
   if (baseDate == null)
   {
     baseDate = new Date().getMidnight();
   }
   var hashKey = baseDate.convertToYYYYMMDDHHMM();
   for (var k in dateHash)
   {
      hashKey += &quot;,&quot; + k + &quot;|&quot; + dateHash[k];
   }
   hashKey += &quot;,&quot; + leadTimeLowerBound.convertToYYYYMMDDHHMM();
   hashKey += &quot;,&quot; + leadTimeUpperBound.convertToYYYYMMDDHHMM();
   if (reminderCache[hashKey] == null)
   {
      //If we don't find a match in this run, then we will
      //cache that the reminder can't be matched.
      reminderCache[hashKey] = false;
   }
   else if (reminderCache[hashKey] == false)
   {
      //We've already tried this date and failed
      return null;
   }
   else
   {
      return reminderCache[hashKey];
   }
   
   var bOffsetSpecified = dateHash[&quot;offsetyear&quot;] != null || 
				dateHash[&quot;offsetmonth&quot;] != null || 
				dateHash[&quot;offsetday&quot;] != null || 
				dateHash[&quot;offsetdayofweek&quot;] != null || 
				dateHash[&quot;recurdays&quot;] != null;
   
   // If we are matching the base date for a dayofweek offset, look for the base date a 
   //little further back.
   var tmp1leadTimeLowerBound = leadTimeLowerBound;  
   if ( dateHash[&quot;offsetdayofweek&quot;] != null)
   {
      tmp1leadTimeLowerBound = leadTimeLowerBound.addDays(-6);  
   }
   var matchedDate = baseDate.findMatch(dateHash, tmp1leadTimeLowerBound, leadTimeUpperBound);
   if (matchedDate != null)
   {
      var newMatchedDate = matchedDate;
      if (dateHash[&quot;recurdays&quot;] != null)
      {
         while (newMatchedDate.getTime() &lt; leadTimeLowerBound.getTime())
         {
            newMatchedDate = newMatchedDate.addDays(dateHash[&quot;recurdays&quot;]);
         }
      }
      else if (dateHash[&quot;offsetyear&quot;] != null || 
		dateHash[&quot;offsetmonth&quot;] != null || 
		dateHash[&quot;offsetday&quot;] != null || 
		dateHash[&quot;offsetdayofweek&quot;] != null)
      {
         var tmpdateHash = cloneParams(dateHash);
         tmpdateHash[&quot;year&quot;] = dateHash[&quot;offsetyear&quot;];
         tmpdateHash[&quot;month&quot;] = dateHash[&quot;offsetmonth&quot;];
         tmpdateHash[&quot;day&quot;] = dateHash[&quot;offsetday&quot;];
         tmpdateHash[&quot;dayofweek&quot;] = dateHash[&quot;offsetdayofweek&quot;];
	 var tmpleadTimeLowerBound = leadTimeLowerBound;
	 var tmpleadTimeUpperBound = leadTimeUpperBound;
	 if (tmpdateHash[&quot;offsetdayofweek&quot;] != null)
	 {
	 	if (tmpdateHash[&quot;negativeOffsetDayOfWeek&quot;] == 1)
		{
		   tmpleadTimeLowerBound = matchedDate.addDays(-6);
		   tmpleadTimeUpperBound = matchedDate;

		}
		else
		{
		   tmpleadTimeLowerBound = matchedDate;
		   tmpleadTimeUpperBound = matchedDate.addDays(6);
		}

	 }
	 newMatchedDate = matchedDate.findMatch(tmpdateHash, tmpleadTimeLowerBound, tmpleadTimeUpperBound);
         //The offset couldn't be matched.  return null.
         if (newMatchedDate == null)
         {
            return null;
         }
      }
      if (newMatchedDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         reminderCache[hashKey] = newMatchedDate;
         return newMatchedDate;
      }
   }
   return null;
};

//This does much the same job as findDateForReminder, but
//this one doesn't deal with offsets or recurring 
//reminders.
Date.prototype.findMatch = function findMatch(dateHash, leadTimeLowerBound, leadTimeUpperBound)
{

   var bSpecifiedYear =     (dateHash[&quot;year&quot;] != null);
   var bSpecifiedMonth =     (dateHash[&quot;month&quot;] != null);
   var bSpecifiedDay =     (dateHash[&quot;day&quot;] != null);
   var bSpecifiedDayOfWeek =     (dateHash[&quot;dayofweek&quot;] != null);
   if (bSpecifiedYear &amp;&amp; bSpecifiedMonth &amp;&amp; bSpecifiedDay)
   {
      return new Date(dateHash[&quot;year&quot;], dateHash[&quot;month&quot;]-1, dateHash[&quot;day&quot;], 0, 0);
   }
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedDay &amp;&amp; bSpecifiedMonth &amp;&amp; !bSpecifiedYear &amp;&amp; !bSpecifiedDayOfWeek)
   {

      //Shortcut -- First try this year.  If it's too small, try next year.
      var tmpMidnight = this.getMidnight();
      var tmpDate = new Date(this.getFullYear(), dateHash[&quot;month&quot;]-1, dateHash[&quot;day&quot;], 0,0);
      if (tmpDate.getTime() &lt; leadTimeLowerBound.getTime())
      {
         tmpDate = new Date((this.getFullYear() + 1), dateHash[&quot;month&quot;]-1, dateHash[&quot;day&quot;], 0,0);
      }
      if ( tmpDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         return tmpDate;
      }
      else
      {
         return null;
      }
   }

   var newDate = leadTimeLowerBound; 
   while (newDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
   {
      var tmp = testDate(newDate, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek);
      if (tmp != null)
        return tmp;
      newDate = newDate.addDays(1);
   }
};

function testDate(testMe, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek)
{
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedYear)
   {
      bMatchedYear = (dateHash[&quot;year&quot;] == testMe.getFullYear());
   }
   if (bSpecifiedMonth)
   {
      bMatchedMonth = ((dateHash[&quot;month&quot;] - 1)  == testMe.getMonth() );
   }
   if (bSpecifiedDay)
   {
      bMatchedDay = (dateHash[&quot;day&quot;] == testMe.getDate());
   }
   if (bSpecifiedDayOfWeek)
   {
      bMatchedDayOfWeek = (dateHash[&quot;dayofweek&quot;] == testMe.getDay());
   }

   if (bMatchedYear &amp;&amp; bMatchedMonth &amp;&amp; bMatchedDay &amp;&amp; bMatchedDayOfWeek)
   {
      return testMe;
   }
};

//Returns true if the date is in between two given dates
Date.prototype.isBetween = function isBetween(lowerBound, upperBound)
{
  return (this.getTime() &gt;= lowerBound.getTime() &amp;&amp; this.getTime() &lt;= upperBound.getTime());
}
//Return a new date, with the time set to midnight (0000)
Date.prototype.getMidnight = function getMidnight()
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0);
};
// Add the specified number of days to a date.
Date.prototype.addDays = function addDays(numberOfDays)
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate() + numberOfDays, 0, 0);
};
//Return the number of days between two dates.
Date.prototype.getDifferenceInDays = function getDifferenceInDays(otherDate)
{
//I have to do it this way, because this way ignores daylight savings
   var tmpDate = this.addDays(0);
   if (this.getTime() &gt; otherDate.getTime())
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() &gt; otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(-1);
      }
      return i;
   }
   else
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() &lt; otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(1);
      }
      return i * -1;
   }
   return 0;
};
function cloneParams(what) {
    var tmp = {};
    for (var i in what) {
        tmp[i] = what[i];
    }
    return tmp;
}
// Substitute date components into a string
Date.prototype.formatStringDateOnly = function formatStringDateOnly(template)
{
	template = template.replace(&quot;YYYY&quot;,this.getFullYear());
	template = template.replace(&quot;YY&quot;,String.zeroPad(this.getFullYear()-2000,2));
	template = template.replace(&quot;MMM&quot;,config.messages.dates.months[this.getMonth()]);
	template = template.replace(&quot;0MM&quot;,String.zeroPad(this.getMonth()+1,2));
	template = template.replace(&quot;MM&quot;,this.getMonth()+1);
	template = template.replace(&quot;DDD&quot;,config.messages.dates.days[this.getDay()]);
	template = template.replace(&quot;0DD&quot;,String.zeroPad(this.getDate(),2));
	template = template.replace(&quot;DD&quot;,this.getDate());
	return template;
};

//}}}</pre>
</div>
<div title="RandomTiddlerPlugin" modifier="escdie" created="201112200847" modified="201201191147" tags="systemConfig plugin" creator="escdie">
<pre>/***
|''Name''|&lt;...&gt;|
|''Description''|&lt;...&gt;|
|''Author''|FND|
|''Version''|&lt;#.#.#&gt;|
|''Status''|&lt;//unknown//; @@experimental@@; @@beta@@; //obsolete//; stable&gt;|
|''Source''|http://devpad.tiddlyspot.com/#&lt;...&gt;|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/contributors/FND/|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''CoreVersion''|2.5.0|
|''Requires''|&lt;...&gt;|
|''Keywords''|&lt;...&gt;|
{{{
&lt;&lt;randomTiddler &quot;systemConfig&quot;&gt;&gt;
}}}
!Source Code
***/
//{{{
(function($) {

var macro = config.macros.randomTiddler = {
	locale: {
		label: &quot;random&quot;,
		tooltip: &quot;display a random tiddler&quot;
	},

	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		var excludeTag = params[0] || &quot;excludeLists&quot;;
		var btn = createTiddlyButton(place, this.locale.label,
			this.locale.tooltip, function() {});
		btn.onclick = null; // XXX: hacky, but createTiddlyButton wouldn't add href otherwise
		$(btn).data(&quot;excludeTag&quot;, excludeTag).click(this.onClick);;
	},
	onClick: function() {
		var btn = $(this);
		var excludeTag = btn.data(&quot;excludeTag&quot;);
		var tiddlers = store.getTiddlers();
		macro.displayRandomTiddler(tiddlers, excludeTag);
	},
	displayRandomTiddler: function(tiddlers, excludeTag) {
		var i = Math.floor(Math.random() * tiddlers.length);
		var tid = tiddlers[i];
		if(!tid.tags.contains(excludeTag)) {
			story.displayTiddler(place, tid);
		} else {
			this.displayRandomTiddler(tiddlers); // XXX: risks infinite recursion
		}
	}
};

})(jQuery);
//}}}</pre>
</div>
<div title="SaveAndReloadMacro" modifier="dger" created="201009101352" modified="201010240512" tags="systemConfig macro macroInfo %tw-elnb %extension">
<pre>/***
|Name|SaveAndReloadMacro|
|Created by|SaqImtiaz|
|Location|http://tw.lewcid.org/#SaveAndReloadMacro|
|Version|1.0|
|Requires|~TW2.x|
!Description:
Provides a button to save and reload TW. Useful if you are testing code and dont have AutoSave enabled.

!Demo:
{{{&lt;&lt;saveAndReload&gt;&gt;}}}&lt;&lt;saveAndReload&gt;&gt;

!Installation:
Copy the contents of this tiddler to your TW, tag with systemConfig, save and reload your TW.

!History:
*24-07-06: ver 1.0

!Code
***/
//{{{
config.macros.saveAndReload={};
config.macros.saveAndReload.handler= function(place,macroName,params,wikifier,paramString,tiddler)
{
        var label = params[0]||&quot;Save &amp; Reload&quot;;
        var tooltip = params[1]||&quot;Save &amp; reload&quot;;
        createTiddlyButton(place,label,tooltip,this.onclick);
}
config.macros.saveAndReload.onclick= function()
{
       saveChanges();
       window.location.reload( false );
}
//}}}</pre>
</div>
<div title="SaveAsPlugin" modifier="dger" created="201009050630" modified="201009301851" tags="SaveAsPackage plugin systemConfig %tw-elnb">
<pre>/***
|Name|SaveAsPlugin|
|Source|http://www.TiddlyTools.com/#SaveAsPlugin|
|Documentation|http://www.TiddlyTools.com/#SaveAsPluginInfo|
|Version|2.2.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements &lt;br&gt;and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Save current document to a different path/filename|
This plugin automatically adds a 'save as' command to the TiddlyWiki 'backstage' menu that allows you to quickly create an exact copy of the current TiddlyWiki document.  The plugin also defines a macro that you can use to place a &quot;save as...&quot; command link into your sidebar/mainmenu/any tiddler (or wherever you like).
&gt;//Note: This plugin now supersedes [[NewDocumentPlugin]], which has been retired and is no longer being distributed.  In addition, the HTML+CSS &quot;snapshot&quot; functionality previous provided by that plugin has been moved to a separate plugin.  Please see [[SnapshotPlugin]] for additional information.//
!!!!!Documentation
&lt;&lt;&lt;
see [[SaveAsPluginInfo]]
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2008.09.06 [2.2.1] corrected handling of autoopen attribute so it only applies when &quot;open&quot; param is specified
| Please see [[SaveAsPluginInfo]] for additional revision details |
2006.02.03 [1.0.0] Created.
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.SaveAsPlugin= {major: 2, minor: 2, revision: 1, date: new Date(2008,9,6)};

config.macros.saveAs = {
	label: &quot;save as...&quot;,
	labelparam: &quot;label:&quot;,
	prompt: &quot;Save current document to a different path/file&quot;,
	promptparam: &quot;prompt:&quot;,
	filePrompt: &quot;Please select or enter a target path/filename&quot;,
	defaultFilename: &quot;new.html&quot;,
	quietparam: &quot;quiet&quot;,
	openparam: &quot;open&quot;,
	askParam: &quot;ask&quot;,
	askMsg: &quot;Enter a tag filter (use * for all tiddlers, 'none' for blank document)&quot;,
	emptyParam: &quot;none&quot;,
	confirmMsg: &quot;Found %0 tiddlers matching\n\n'%1'\n\nPress OK to proceed&quot;,
	okmsg: &quot;%0 tiddlers written to %1&quot;,
	failmsg: &quot;An error occurred while creating %1&quot;,
	filter: &quot;&quot;,
	handler: function(place,macroName,params) {
		if (params[0] &amp;&amp; params[0].substr(0,this.labelparam.length)==this.labelparam)
			var label=params.shift().substr(this.labelparam.length)
		if (params[0] &amp;&amp; params[0].substr(0,this.promptparam.length)==this.promptparam)
			var prompt=params.shift().substr(this.promptparam.length)
		var btn=createTiddlyButton(place,label||this.label,prompt||this.prompt,
			function(){config.macros.saveAs.go(
				this.getAttribute('filter'),
				this.getAttribute('quiet')==&quot;true&quot;,
				this.getAttribute('autoopen')==&quot;true&quot;)}
		);
		var quiet=(params[0] &amp;&amp; params[0]==this.quietparam); if (quiet) params.shift();
		var autoopen=(params[0] &amp;&amp; params[0]==this.openparam); if (autoopen) params.shift();
		btn.setAttribute(&quot;quiet&quot;,quiet?&quot;true&quot;:&quot;false&quot;);
		btn.setAttribute(&quot;autoopen&quot;,autoopen?&quot;true&quot;:&quot;false&quot;);
		btn.setAttribute(&quot;filter&quot;,params.join(&quot; &quot;));
	},
	go: function(filter,quiet,autoopen) {
		var cm=config.messages; // abbreviation
		var cms=config.macros.saveAs; // abbreviation
		if (window.location.protocol!=&quot;file:&quot;) // make sure we are local
			{ displayMessage(cm.notFileUrlError); return; }
		var currPath=getLocalPath(window.location.href);
		var original=loadFile(currPath);
		if (!original) // if current file not loaded
			{ displayMessage(cm.cantSaveError); return; }
		if (!locateStoreArea(original)) // make sure it is a valid TW document
			{ displayMessage(cm.invalidFileError.format([currPath])); return; }
		// get tidders, assemble revised document and write target
		var tids=cms.selectTiddlers(filter);
		if (tids===false) return; // cancelled by user
		if (cms.filter!=cms.emptyParam &amp;&amp; cms.filter.length &amp;&amp; !quiet)
			if (!confirm(cms.confirmMsg.format([tids.length,cms.filter]))) return;
		var target=cms.getTarget();
		if (!target) return; // cancelled by user
		var revised=cms.assemble(original,tids);
		var link=&quot;file:///&quot;+target.replace(/\\/g,'/');
		var ok=saveFile(target,revised);
		clearMessage();
		displayMessage((ok?cms.okmsg:cms.failmsg).format([tids.length,target]),link);
		if (ok &amp;&amp; autoopen) { var w=window.open(link); w.focus(); }
	},
	selectTiddlers: function(filter) {
		var cms=config.macros.saveAs; // abbreviation
		cms.filter=filter||&quot;&quot;;
		if (filter==cms.emptyParam) return [];
		if (!filter||!filter.length) return store.getTiddlers(&quot;title&quot;);
		// get filtered tiddlers
		if (filter==config.macros.saveAs.askParam) {
			filter=prompt(config.macros.saveAs.askMsg,&quot;&quot;);
			if (!filter) return false;  // cancelled by user
			cms.filter=filter==&quot;*&quot;?&quot;&quot;:filter;
			if (filter==&quot;*&quot;) return store.getTiddlers(&quot;title&quot;);
		}
		return store.filterTiddlers(&quot;[tag[&quot;+filter+&quot;]]&quot;);
	},
	assemble: function(original,tids) {
		var divs=[]; for (var i=0; i&lt;tids.length; i++)
			divs.push(store.getSaver().externalizeTiddler(store,tids[i]));
		var divs=divs.join(&quot;\n&quot;);
		var posDiv = locateStoreArea(original);
		var revised = original.substr(0,posDiv[0]+startSaveArea.length)+&quot;\n&quot;
			+convertUnicodeToUTF8(divs)+&quot;\n&quot;+original.substr(posDiv[1]);
		var newSiteTitle = convertUnicodeToUTF8(getPageTitle()).htmlEncode();
		revised = revised.replaceChunk(&quot;&lt;title&quot;+&quot;&gt;&quot;,&quot;&lt;/title&quot;+&quot;&gt;&quot;,&quot; &quot; + newSiteTitle + &quot; &quot;);
		revised = updateLanguageAttribute(revised);
		// reset all MARKUP blocks
		revised = updateMarkupBlock(revised,&quot;PRE-HEAD&quot;);
		revised = updateMarkupBlock(revised,&quot;POST-HEAD&quot;);
		revised = updateMarkupBlock(revised,&quot;PRE-BODY&quot;);
		revised = updateMarkupBlock(revised,&quot;POST-SCRIPT&quot;);
		return revised;
	},
	getTarget: function() {
		var cms=config.macros.saveAs; // abbreviation
		// get new target path/filename
		var newPath=getLocalPath(window.location.href);
		var slashpos=newPath.lastIndexOf(&quot;/&quot;); if (slashpos==-1) slashpos=newPath.lastIndexOf(&quot;\\&quot;); 
		if (slashpos!=-1) newPath=newPath.substr(0,slashpos+1); // trim filename
		var target=cms.askForFilename(cms.filePrompt,newPath,cms.defaultFilename);
		if (!target) return; // cancelled by user
		// if specified file does not include a path, assemble fully qualified path and filename
		var slashpos=target.lastIndexOf(&quot;/&quot;); if (slashpos==-1) slashpos=target.lastIndexOf(&quot;\\&quot;);
		if (slashpos==-1) target=target+cms.defaultFilename;
		return target;
	},
	askForFilename: function(msg,path,file) {
		if(window.Components) { // moz
			try {
				netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
				var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
				var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
				picker.init(window, msg, nsIFilePicker.modeSave);
				var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
				thispath.initWithPath(path);
				picker.displayDirectory=thispath;
				picker.defaultExtension='html';
				picker.defaultString=file;
				picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
				if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
			}
			catch(e) { alert('error during local file access: '+e.toString()) }
		}
		else { // IE
			try { // XP/Vista only
				var s = new ActiveXObject('UserAccounts.CommonDialog');
				s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
				s.FilterIndex=3; // default to HTML files;
				s.InitialDir=path;
				s.FileName=file;
				if (s.showOpen()) var result=s.FileName;
			}
			catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
		}
		return result;
	}
};
//}}}
//{{{
// automatically add saveAs to backstage
config.tasks.saveAs = {
	text: &quot;saveAs&quot;,
	tooltip: config.macros.saveAs.prompt,
	action: function(){ clearMessage(); config.macros.saveAs.go(); }
}
config.backstageTasks.splice(config.backstageTasks.indexOf(&quot;save&quot;)+1,0,&quot;saveAs&quot;);
//}}}</pre>
</div>
<div title="SyntaxHighlighterPlugin" modifier="escdie" created="201007170951" modified="201103111301" tags="systemConfig plugin pluginInfo %tw-elnb excludeSearch">
<pre>/***
!Metadata:
|''Name:''|SyntaxHighlighterPlugin|
|''Description:''|Code Syntax Highlighter Plugin for TiddlyWiki.|
|''Version:''|1.1.3|
|''Date:''|Oct 24, 2008|
|''Source:''|http://www.coolcode.cn/show-310-1.html|
|''Author:''|Ma Bingyao (andot (at) ujn (dot) edu (dot) cn)|
|''License:''|[[GNU Lesser General Public License|http://www.gnu.org/licenses/lgpl.txt]]|
|''~CoreVersion:''|2.4.1|
|''Browser:''|Firefox 1.5+; InternetExplorer 6.0; Safari; Opera; Chrome; etc.|

!Syntax:
{{{
&lt;code options&gt;
codes
&lt;/code&gt;
}}}

!Examples:
{{{
&lt;code java&gt;
public class HelloWorld {
    public static void main(String args[]) {
        System.out.println(&quot;HelloWorld!&quot;);
    }
}
&lt;/code&gt;
}}}

!Revision History:
|''Version''|''Date''|''Note''|
|1.1.2|Oct 15, 2008|Optimize Highlight|
|1.0.0|Oct 13, 2008|Initial release|

!Code section:
***/
//{{{
var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{AboutDialog:&quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;About...&lt;/title&gt;&lt;/head&gt;&lt;body class=\&quot;dp-about\&quot;&gt;&lt;table cellspacing=\&quot;0\&quot;&gt;&lt;tr&gt;&lt;td class=\&quot;copy\&quot;&gt;&lt;p class=\&quot;title\&quot;&gt;dp.SyntaxHighlighter&lt;/div&gt;&lt;div class=\&quot;para\&quot;&gt;Version: {V}&lt;/p&gt;&lt;p&gt;&lt;a href=\&quot;http://www.dreamprojections.com/syntaxhighlighter/?ref=about\&quot; target=\&quot;_blank\&quot;&gt;http://www.dreamprojections.com/syntaxhighlighter&lt;/a&gt;&lt;/p&gt;&amp;copy;2004-2007 Alex Gorbatchev.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=\&quot;footer\&quot;&gt;&lt;input type=\&quot;button\&quot; class=\&quot;close\&quot; value=\&quot;OK\&quot; onClick=\&quot;window.close()\&quot;/&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;&quot;},ClipboardSwf:null,Version:&quot;1.5.1&quot;}};dp.SyntaxHighlighter=dp.sh;dp.sh.Toolbar.Commands={ExpandSource:{label:&quot;+ expand source&quot;,check:function($){return $.collapse},func:function($,_){$.parentNode.removeChild($);_.div.className=_.div.className.replace(&quot;collapsed&quot;,&quot;&quot;)}},ViewSource:{label:&quot;view plain&quot;,func:function($,_){var A=dp.sh.Utils.FixForBlogger(_.originalCode).replace(/&lt;/g,&quot;&amp;lt;&quot;),B=window.open(&quot;&quot;,&quot;_blank&quot;,&quot;width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0&quot;);B.document.write(&quot;&lt;textarea style=\&quot;width:99%;height:99%\&quot;&gt;&quot;+A+&quot;&lt;/textarea&gt;&quot;);B.document.close()}},CopyToClipboard:{label:&quot;copy to clipboard&quot;,check:function(){return window.clipboardData!=null||dp.sh.ClipboardSwf!=null},func:function($,A){var B=dp.sh.Utils.FixForBlogger(A.originalCode).replace(/&amp;lt;/g,&quot;&lt;&quot;).replace(/&amp;gt;/g,&quot;&gt;&quot;).replace(/&amp;amp;/g,&quot;&amp;&quot;);if(window.clipboardData)window.clipboardData.setData(&quot;text&quot;,B);else if(dp.sh.ClipboardSwf!=null){var _=A.flashCopier;if(_==null){_=document.createElement(&quot;div&quot;);A.flashCopier=_;A.div.appendChild(_)}_.innerHTML=&quot;&lt;embed src=\&quot;&quot;+dp.sh.ClipboardSwf+&quot;\&quot; FlashVars=\&quot;clipboard=&quot;+encodeURIComponent(B)+&quot;\&quot; width=\&quot;0\&quot; height=\&quot;0\&quot; type=\&quot;application/x-shockwave-flash\&quot;&gt;&lt;/embed&gt;&quot;}alert(&quot;The code is in your clipboard now&quot;)}},PrintSource:{label:&quot;print&quot;,func:function($,B){var _=document.createElement(&quot;IFRAME&quot;),A=null;_.style.cssText=&quot;position:absolute;width:0px;height:0px;left:-500px;top:-500px;&quot;;document.body.appendChild(_);A=_.contentWindow.document;dp.sh.Utils.CopyStyles(A,window.document);A.write(&quot;&lt;div class=\&quot;&quot;+B.div.className.replace(&quot;collapsed&quot;,&quot;&quot;)+&quot; printing\&quot;&gt;&quot;+B.div.innerHTML+&quot;&lt;/div&gt;&quot;);A.close();_.contentWindow.focus();_.contentWindow.print();alert(&quot;Printing...&quot;);document.body.removeChild(_)}},About:{label:&quot;?&quot;,func:function(_){var A=window.open(&quot;&quot;,&quot;_blank&quot;,&quot;dialog,width=300,height=150,scrollbars=0&quot;),$=A.document;dp.sh.Utils.CopyStyles($,window.document);$.write(dp.sh.Strings.AboutDialog.replace(&quot;{V}&quot;,dp.sh.Version));$.close();A.focus()}}};dp.sh.Toolbar.Create=function(B){var A=document.createElement(&quot;DIV&quot;);A.className=&quot;tools&quot;;for(var _ in dp.sh.Toolbar.Commands){var $=dp.sh.Toolbar.Commands[_];if($.check!=null&amp;&amp;!$.check(B))continue;A.innerHTML+=&quot;&lt;a href=\&quot;#\&quot; onclick=\&quot;dp.sh.Toolbar.Command('&quot;+_+&quot;',this);return false;\&quot;&gt;&quot;+$.label+&quot;&lt;/a&gt;&quot;}return A};dp.sh.Toolbar.Command=function(_,$){var A=$;while(A!=null&amp;&amp;A.className.indexOf(&quot;dp-highlighter&quot;)==-1)A=A.parentNode;if(A!=null)dp.sh.Toolbar.Commands[_].func($,A.highlighter)};dp.sh.Utils.CopyStyles=function(A,_){var $=_.getElementsByTagName(&quot;link&quot;);for(var B=0;B&lt;$.length;B++)if($[B].rel.toLowerCase()==&quot;stylesheet&quot;)A.write(&quot;&lt;link type=\&quot;text/css\&quot; rel=\&quot;stylesheet\&quot; href=\&quot;&quot;+$[B].href+&quot;\&quot;&gt;&lt;/link&gt;&quot;)};dp.sh.Utils.FixForBlogger=function($){return(dp.sh.isBloggerMode==true)?$.replace(/&lt;br\s*\/?&gt;|&amp;lt;br\s*\/?&amp;gt;/gi,&quot;\n&quot;):$};dp.sh.RegexLib={MultiLineCComments:new RegExp(&quot;/\\*[\\s\\S]*?\\*/&quot;,&quot;gm&quot;),SingleLineCComments:new RegExp(&quot;//.*$&quot;,&quot;gm&quot;),SingleLinePerlComments:new RegExp(&quot;#.*$&quot;,&quot;gm&quot;),DoubleQuotedString:new RegExp(&quot;\&quot;(?:\\.|(\\\\\\\&quot;)|[^\\\&quot;\&quot;\\n])*\&quot;&quot;,&quot;g&quot;),SingleQuotedString:new RegExp(&quot;'(?:\\.|(\\\\\\')|[^\\''\\n])*'&quot;,&quot;g&quot;)};dp.sh.Match=function(_,$,A){this.value=_;this.index=$;this.length=_.length;this.css=A};dp.sh.Highlighter=function(){this.noGutter=false;this.addControls=true;this.collapse=false;this.tabsToSpaces=true;this.wrapColumn=80;this.showColumns=true};dp.sh.Highlighter.SortCallback=function($,_){if($.index&lt;_.index)return-1;else if($.index&gt;_.index)return 1;else if($.length&lt;_.length)return-1;else if($.length&gt;_.length)return 1;return 0};dp.sh.Highlighter.prototype.CreateElement=function(_){var $=document.createElement(_);$.highlighter=this;return $};dp.sh.Highlighter.prototype.GetMatches=function(_,B){var $=0,A=null;while((A=_.exec(this.code))!=null)this.matches[this.matches.length]=new dp.sh.Match(A[0],A.index,B)};dp.sh.Highlighter.prototype.AddBit=function($,A){if($==null||$.length==0)return;var C=this.CreateElement(&quot;SPAN&quot;);$=$.replace(/ /g,&quot;&amp;nbsp;&quot;);$=$.replace(/&lt;/g,&quot;&amp;lt;&quot;);$=$.replace(/\n/gm,&quot;&amp;nbsp;&lt;br&gt;&quot;);if(A!=null){if((/br/gi).test($)){var _=$.split(&quot;&amp;nbsp;&lt;br&gt;&quot;);for(var B=0;B&lt;_.length;B++){C=this.CreateElement(&quot;SPAN&quot;);C.className=A;C.innerHTML=_[B];this.div.appendChild(C);if(B+1&lt;_.length)this.div.appendChild(this.CreateElement(&quot;BR&quot;))}}else{C.className=A;C.innerHTML=$;this.div.appendChild(C)}}else{C.innerHTML=$;this.div.appendChild(C)}};dp.sh.Highlighter.prototype.IsInside=function(_){if(_==null||_.length==0)return false;for(var A=0;A&lt;this.matches.length;A++){var $=this.matches[A];if($==null)continue;if((_.index&gt;$.index)&amp;&amp;(_.index&lt;$.index+$.length))return true}return false};dp.sh.Highlighter.prototype.ProcessRegexList=function(){for(var $=0;$&lt;this.regexList.length;$++)this.GetMatches(this.regexList[$].regex,this.regexList[$].css)};dp.sh.Highlighter.prototype.ProcessSmartTabs=function(E){var B=E.split(&quot;\n&quot;),$=&quot;&quot;,D=4,A=&quot;\t&quot;;function _(A,E,_){var B=A.substr(0,E),C=A.substr(E+1,A.length),$=&quot;&quot;;for(var D=0;D&lt;_;D++)$+=&quot; &quot;;return B+$+C}function C(B,C){if(B.indexOf(A)==-1)return B;var D=0;while((D=B.indexOf(A))!=-1){var $=C-D%C;B=_(B,D,$)}return B}for(var F=0;F&lt;B.length;F++)$+=C(B[F],D)+&quot;\n&quot;;return $};dp.sh.Highlighter.prototype.SwitchToList=function(){var C=this.div.innerHTML.replace(/&lt;(br)\/?&gt;/gi,&quot;\n&quot;),B=C.split(&quot;\n&quot;);if(this.addControls==true)this.bar.appendChild(dp.sh.Toolbar.Create(this));if(this.showColumns){var A=this.CreateElement(&quot;div&quot;),_=this.CreateElement(&quot;div&quot;),E=10,G=1;while(G&lt;=150)if(G%E==0){A.innerHTML+=G;G+=(G+&quot;&quot;).length}else{A.innerHTML+=&quot;&amp;middot;&quot;;G++}_.className=&quot;columns&quot;;_.appendChild(A);this.bar.appendChild(_)}for(var G=0,D=this.firstLine;G&lt;B.length-1;G++,D++){var $=this.CreateElement(&quot;LI&quot;),F=this.CreateElement(&quot;SPAN&quot;);$.className=(G%2==0)?&quot;alt&quot;:&quot;&quot;;F.innerHTML=B[G]+&quot;&amp;nbsp;&quot;;$.appendChild(F);this.ol.appendChild($)}this.div.innerHTML=&quot;&quot;};dp.sh.Highlighter.prototype.Highlight=function(C){function A($){return $.replace(/^\s*(.*?)[\s\n]*$/g,&quot;$1&quot;)}function $($){return $.replace(/\n*$/,&quot;&quot;).replace(/^\n*/,&quot;&quot;)}function _(B){var E=dp.sh.Utils.FixForBlogger(B).split(&quot;\n&quot;),C=new Array(),D=new RegExp(&quot;^\\s*&quot;,&quot;g&quot;),$=1000;for(var F=0;F&lt;E.length&amp;&amp;$&gt;0;F++){if(A(E[F]).length==0)continue;var _=D.exec(E[F]);if(_!=null&amp;&amp;_.length&gt;0)$=Math.min(_[0].length,$)}if($&gt;0)for(F=0;F&lt;E.length;F++)E[F]=E[F].substr($);return E.join(&quot;\n&quot;)}function D(A,$,_){return A.substr($,_-$)}var F=0;if(C==null)C=&quot;&quot;;this.originalCode=C;this.code=$(_(C));this.div=this.CreateElement(&quot;DIV&quot;);this.bar=this.CreateElement(&quot;DIV&quot;);this.ol=this.CreateElement(&quot;OL&quot;);this.matches=new Array();this.div.className=&quot;dp-highlighter&quot;;this.div.highlighter=this;this.bar.className=&quot;bar&quot;;this.ol.start=this.firstLine;if(this.CssClass!=null)this.ol.className=this.CssClass;if(this.collapse)this.div.className+=&quot; collapsed&quot;;if(this.noGutter)this.div.className+=&quot; nogutter&quot;;if(this.tabsToSpaces==true)this.code=this.ProcessSmartTabs(this.code);this.ProcessRegexList();if(this.matches.length==0){this.AddBit(this.code,null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol);return}this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);for(var E=0;E&lt;this.matches.length;E++)if(this.IsInside(this.matches[E]))this.matches[E]=null;for(E=0;E&lt;this.matches.length;E++){var B=this.matches[E];if(B==null||B.length==0)continue;this.AddBit(D(this.code,F,B.index),null);this.AddBit(B.value,B.css);F=B.index+B.length}this.AddBit(this.code.substr(F),null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol)};dp.sh.Highlighter.prototype.GetKeywords=function($){return&quot;\\b&quot;+$.replace(/ /g,&quot;\\b|\\b&quot;)+&quot;\\b&quot;};dp.sh.BloggerMode=function(){dp.sh.isBloggerMode=true};dp.sh.HighlightAll=function(N,B,K,I,O,E){function A(){var $=arguments;for(var _=0;_&lt;$.length;_++){if($[_]==null)continue;if(typeof($[_])==&quot;string&quot;&amp;&amp;$[_]!=&quot;&quot;)return $[_]+&quot;&quot;;if(typeof($[_])==&quot;object&quot;&amp;&amp;$[_].value!=&quot;&quot;)return $[_].value+&quot;&quot;}return null}function J($,_){for(var A=0;A&lt;_.length;A++)if(_[A]==$)return true;return false}function L(A,B,C){var _=new RegExp(&quot;^&quot;+A+&quot;\\[(\\w+)\\]$&quot;,&quot;gi&quot;),$=null;for(var D=0;D&lt;B.length;D++)if(($=_.exec(B[D]))!=null)return $[1];return C}function C(B,A,_){var $=document.getElementsByTagName(_);for(var C=0;C&lt;$.length;C++)if($[C].getAttribute(&quot;name&quot;)==A)B.push($[C])}var T=[],P=null,M={},$=&quot;innerHTML&quot;;C(T,N,&quot;pre&quot;);C(T,N,&quot;textarea&quot;);if(T.length==0)return;for(var R in dp.sh.Brushes){var F=dp.sh.Brushes[R].Aliases;if(F==null)continue;for(var G=0;G&lt;F.length;G++)M[F[G]]=R}for(G=0;G&lt;T.length;G++){var _=T[G],U=A(_.attributes[&quot;class&quot;],_.className,_.attributes[&quot;language&quot;],_.language),Q=&quot;&quot;;if(U==null)continue;U=U.split(&quot;:&quot;);Q=U[0].toLowerCase();if(M[Q]==null)continue;P=new dp.sh.Brushes[M[Q]]();_.style.display=&quot;none&quot;;P.noGutter=(B==null)?J(&quot;nogutter&quot;,U):!B;P.addControls=(K==null)?!J(&quot;nocontrols&quot;,U):K;P.collapse=(I==null)?J(&quot;collapse&quot;,U):I;P.showColumns=(E==null)?J(&quot;showcolumns&quot;,U):E;var D=document.getElementsByTagName(&quot;head&quot;)[0];if(P.Style&amp;&amp;D){var S=document.createElement(&quot;style&quot;);S.setAttribute(&quot;type&quot;,&quot;text/css&quot;);if(S.styleSheet)S.styleSheet.cssText=P.Style;else{var H=document.createTextNode(P.Style);S.appendChild(H)}D.appendChild(S)}P.firstLine=(O==null)?parseInt(L(&quot;firstline&quot;,U,1)):O;P.Highlight(_[$]);P.source=_;_.parentNode.insertBefore(P.div,_)}};version.extensions.SyntaxHighLighterPlugin={major:1,minor:1,revision:3,date:new Date(2008,10,24)};dp.sh.ClipboardSwf=&quot;tw-elnb/tools/clipboard.swf&quot;;dp.sh.Highlight=function(_,Q,B,J,H,M,D){function A(){var $=arguments;for(var _=0;_&lt;$.length;_++){if($[_]==null)continue;if(typeof($[_])==&quot;string&quot;&amp;&amp;$[_]!=&quot;&quot;)return $[_]+&quot;&quot;;if(typeof($[_])==&quot;object&quot;&amp;&amp;$[_].value!=&quot;&quot;)return $[_].value+&quot;&quot;}return null}function I($,_){for(var A=0;A&lt;_.length;A++)if(_[A]==$)return true;return false}function K(A,B,C){var _=new RegExp(&quot;^&quot;+A+&quot;\\[(\\w+)\\]$&quot;,&quot;gi&quot;),$=null;for(var D=0;D&lt;B.length;D++)if(($=_.exec(B[D]))!=null)return $[1];return C}var N=null,$=&quot;innerHTML&quot;;if(this.registered==undefined){var L={};for(var O in dp.sh.Brushes){var E=dp.sh.Brushes[O].Aliases;if(E==null)continue;for(var F=0;F&lt;E.length;F++)L[E[F]]=O}this.registered=L}Q=Q.split(&quot;:&quot;);language=Q[0].toLowerCase();if(this.registered[language]==null)return;N=new dp.sh.Brushes[this.registered[language]]();_.style.display=&quot;none&quot;;N.noGutter=(B==null)?I(&quot;nogutter&quot;,Q):!B;N.addControls=(J==null)?!I(&quot;nocontrols&quot;,Q):J;N.collapse=(H==null)?I(&quot;collapse&quot;,Q):H;N.showColumns=(D==null)?I(&quot;showcolumns&quot;,Q):D;var C=document.getElementsByTagName(&quot;head&quot;)[0],P=document.getElementById(N.CssClass);if(N.Style&amp;&amp;C&amp;&amp;!P){P=document.createElement(&quot;style&quot;);P.setAttribute(&quot;id&quot;,N.CssClass);P.setAttribute(&quot;type&quot;,&quot;text/css&quot;);if(P.styleSheet)P.styleSheet.cssText=N.Style;else{var G=document.createTextNode(N.Style);P.appendChild(G)}C.appendChild(P)}N.firstLine=(M==null)?parseInt(K(&quot;firstline&quot;,Q,1)):M;N.Highlight(_[$]);N.source=_;_.parentNode.insertBefore(N.div,_)};config.formatters.push({name:&quot;SyntaxHighlighter&quot;,match:&quot;^&lt;code[\\s]+[^&gt;]+&gt;\\n&quot;,element:&quot;pre&quot;,handler:function(_){this.lookaheadRegExp=/&lt;code[\s]+([^&gt;]+)&gt;\n((?:^[^\n]*\n)+?)(^&lt;\/code&gt;$\n?)/mg;this.lookaheadRegExp.lastIndex=_.matchStart;var $=this.lookaheadRegExp.exec(_.source);if($&amp;&amp;$.index==_.matchStart){var C=$[1],B=$[2];if(config.browser.isIE)B=B.replace(/\n/g,&quot;\r&quot;);var A=createTiddlyElement(_.output,this.element,null,null,B);dp.sh.Highlight(A,C);_.nextMatch=$.index+$[0].length}}});config.formatterHelpers.enclosedTextHelper=function(_){this.lookaheadRegExp.lastIndex=_.matchStart;var $=this.lookaheadRegExp.exec(_.source);if($&amp;&amp;$.index==_.matchStart){var B=$[1];if(config.browser.isIE)B=B.replace(/\n/g,&quot;\r&quot;);var A=createTiddlyElement(_.output,this.element,null,null,B);switch(_.matchText){case&quot;/*{{{*/\n&quot;:dp.sh.Highlight(A,&quot;css&quot;);break;case&quot;//{{{\n&quot;:dp.sh.Highlight(A,&quot;js&quot;);break;case&quot;&lt;!--{{{--&gt;\n&quot;:dp.sh.Highlight(A,&quot;xml&quot;);break}_.nextMatch=$.index+$[0].length}};dp.sh.Brushes.AS3=function(){var _=&quot;class interface package&quot;,$=&quot;Array Boolean Date decodeURI decodeURIComponent encodeURI encodeURIComponent escape &quot;+&quot;int isFinite isNaN isXMLName Number Object parseFloat parseInt &quot;+&quot;String trace uint unescape XML XMLList &quot;+&quot;Infinity -Infinity NaN undefined &quot;+&quot;as delete instanceof is new typeof &quot;+&quot;break case catch continue default do each else finally for if in &quot;+&quot;label return super switch throw try while with &quot;+&quot;dynamic final internal native override private protected public static &quot;+&quot;...rest const extends function get implements namespace set &quot;+&quot;import include use &quot;+&quot;AS3 flash_proxy object_proxy &quot;+&quot;false null this true &quot;+&quot;void Null&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.MultiLineCComments,css:&quot;blockcomment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;^\\s*#.*&quot;,&quot;gm&quot;),css:&quot;preprocessor&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gm&quot;),css:&quot;definition&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;},{regex:new RegExp(&quot;var&quot;,&quot;gm&quot;),css:&quot;variable&quot;}];this.CssClass=&quot;dp-as&quot;;this.Style=&quot;.dp-as .comment { color: #009900; font-style: italic; }&quot;+&quot;.dp-as .blockcomment { color: #3f5fbf; }&quot;+&quot;.dp-as .string { color: #990000; }&quot;+&quot;.dp-as .preprocessor { color: #0033ff; }&quot;+&quot;.dp-as .definition { color: #9900cc; font-weight: bold; }&quot;+&quot;.dp-as .keyword { color: #0033ff; }&quot;+&quot;.dp-as .variable { color: #6699cc; font-weight: bold; }&quot;};dp.sh.Brushes.AS3.prototype=new dp.sh.Highlighter();dp.sh.Brushes.AS3.Aliases=[&quot;as&quot;,&quot;actionscript&quot;,&quot;ActionScript&quot;,&quot;as3&quot;,&quot;AS3&quot;];dp.sh.Brushes.Bash=function(){var _=&quot;alias bg bind break builtin cd command compgen complete continue &quot;+&quot;declare dirs disown echo enable eval exec exit export fc fg &quot;+&quot;getopts hash help history jobs kill let local logout popd printf &quot;+&quot;pushd pwd read readonly return set shift shopt source &quot;+&quot;suspend test times trap type typeset ulimit umask unalias unset wait&quot;,$=&quot;case do done elif else esac fi for function if in select then &quot;+&quot;time until while&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;[()[\\]{}]&quot;,&quot;g&quot;),css:&quot;delim&quot;},{regex:new RegExp(&quot;\\$\\w+&quot;,&quot;g&quot;),css:&quot;vars&quot;},{regex:new RegExp(&quot;\\w+=&quot;,&quot;g&quot;),css:&quot;vars&quot;},{regex:new RegExp(&quot;\\s-\\w+&quot;,&quot;g&quot;),css:&quot;flag&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gm&quot;),css:&quot;builtin&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-bash&quot;;this.Style=&quot;.dp-bash .builtin {color: maroon; font-weight: bold;}&quot;+&quot;.dp-bash .comment {color: gray;}&quot;+&quot;.dp-bash .delim {font-weight: bold;}&quot;+&quot;.dp-bash .flag {color: green;}&quot;+&quot;.dp-bash .string {color: red;}&quot;+&quot;.dp-bash .vars {color: blue;}&quot;};dp.sh.Brushes.Bash.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Bash.Aliases=[&quot;bash&quot;,&quot;sh&quot;];dp.sh.Brushes.Batch=function(){var _=&quot;APPEND ATTRIB CD CHDIR CHKDSK CHOICE CLS COPY DEL ERASE DELTREE &quot;+&quot;DIR EXIT FC COMP FDISK FIND FORMAT FSUTIL HELP JOIN &quot;+&quot;LABEL LOADFIX MK MKDIR MEM MEMMAKER MORE MOVE MSD PCPARK &quot;+&quot;PRINT RD RMDIR REN SCANDISK SHARE SORT SUBST SYS &quot;+&quot;TIME DATE TREE TRUENAME TYPE UNDELETE VER XCOPY&quot;,$=&quot;DO ELSE FOR IN CALL CHOICE GOTO SHIFT PAUSE ERRORLEVEL &quot;+&quot;IF NOT EXIST LFNFOR START SETLOCAL ENDLOCAL ECHO SET&quot;;this.regexList=[{regex:new RegExp(&quot;REM.*$&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:new RegExp(&quot;::.*$&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;[()[\\]{}]&quot;,&quot;g&quot;),css:&quot;delim&quot;},{regex:new RegExp(&quot;%\\w+%&quot;,&quot;g&quot;),css:&quot;vars&quot;},{regex:new RegExp(&quot;%%\\w+&quot;,&quot;g&quot;),css:&quot;vars&quot;},{regex:new RegExp(&quot;\\w+=&quot;,&quot;g&quot;),css:&quot;vars&quot;},{regex:new RegExp(&quot;@\\w+&quot;,&quot;g&quot;),css:&quot;keyword&quot;},{regex:new RegExp(&quot;:\\w+&quot;,&quot;g&quot;),css:&quot;keyword&quot;},{regex:new RegExp(&quot;\\s/\\w+&quot;,&quot;g&quot;),css:&quot;flag&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gm&quot;),css:&quot;builtin&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-batch&quot;;this.Style=&quot;.dp-batch .builtin {color: maroon; font-weight: bold;}&quot;+&quot;.dp-batch .comment {color: gray;}&quot;+&quot;.dp-batch .delim {font-weight: bold;}&quot;+&quot;.dp-batch .flag {color: green;}&quot;+&quot;.dp-batch .string {color: red;}&quot;+&quot;.dp-batch .vars {color: blue;font-weight: bold;}&quot;};dp.sh.Brushes.Batch.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Batch.Aliases=[&quot;batch&quot;,&quot;dos&quot;];dp.sh.Brushes.ColdFusion=function(){this.CssClass=&quot;dp-coldfusion&quot;;this.Style=&quot;.dp-coldfusion { font: 13px \&quot;Courier New\&quot;, Courier, monospace; }&quot;+&quot;.dp-coldfusion .tag, .dp-coldfusion .tag-name { color: #990033; }&quot;+&quot;.dp-coldfusion .attribute { color: #990033; }&quot;+&quot;.dp-coldfusion .attribute-value { color: #0000FF; }&quot;+&quot;.dp-coldfusion .cfcomments { background-color: #FFFF99; color: #000000; }&quot;+&quot;.dp-coldfusion .cfscriptcomments { color: #999999; }&quot;+&quot;.dp-coldfusion .keywords { color: #0000FF; }&quot;+&quot;.dp-coldfusion .mgkeywords { color: #CC9900; }&quot;+&quot;.dp-coldfusion .numbers { color: #ff0000; }&quot;+&quot;.dp-coldfusion .strings { color: green; }&quot;;this.mgKeywords=&quot;setvalue getvalue addresult viewcollection viewstate&quot;;this.keywords=&quot;var eq neq gt gte lt lte not and or true false &quot;+&quot;abs acos addsoaprequestheader addsoapresponseheader &quot;+&quot;arrayappend arrayavg arrayclear arraydeleteat arrayinsertat &quot;+&quot;arrayisempty arraylen arraymax arraymin arraynew &quot;+&quot;arrayprepend arrayresize arrayset arraysort arraysum &quot;+&quot;arrayswap arraytolist asc asin atn binarydecode binaryencode &quot;+&quot;bitand bitmaskclear bitmaskread bitmaskset bitnot bitor bitshln &quot;+&quot;bitshrn bitxor ceiling charsetdecode charsetencode chr cjustify &quot;+&quot;compare comparenocase cos createdate createdatetime createobject &quot;+&quot;createobject createobject createobject createobject createodbcdate &quot;+&quot;createodbcdatetime createodbctime createtime createtimespan &quot;+&quot;createuuid dateadd datecompare dateconvert datediff dateformat &quot;+&quot;datepart day dayofweek dayofweekasstring dayofyear daysinmonth &quot;+&quot;daysinyear de decimalformat decrementvalue decrypt decryptbinary &quot;+&quot;deleteclientvariable directoryexists dollarformat duplicate encrypt &quot;+&quot;encryptbinary evaluate exp expandpath fileexists find findnocase &quot;+&quot;findoneof firstdayofmonth fix formatbasen generatesecretkey &quot;+&quot;getauthuser getbasetagdata getbasetaglist getbasetemplatepath &quot;+&quot;getclientvariableslist getcontextroot getcurrenttemplatepath &quot;+&quot;getdirectoryfrompath getencoding getexception getfilefrompath &quot;+&quot;getfunctionlist getgatewayhelper gethttprequestdata gethttptimestring &quot;+&quot;getk2serverdoccount getk2serverdoccountlimit getlocale &quot;+&quot;getlocaledisplayname getlocalhostip getmetadata getmetricdata &quot;+&quot;getpagecontext getprofilesections getprofilestring getsoaprequest &quot;+&quot;getsoaprequestheader getsoapresponse getsoapresponseheader &quot;+&quot;gettempdirectory gettempfile gettemplatepath gettickcount &quot;+&quot;gettimezoneinfo gettoken hash hour htmlcodeformat htmleditformat &quot;+&quot;iif incrementvalue inputbasen insert int isarray isbinary isboolean &quot;+&quot;iscustomfunction isdate isdebugmode isdefined isk2serverabroker &quot;+&quot;isk2serverdoccountexceeded isk2serveronline isleapyear islocalhost &quot;+&quot;isnumeric isnumericdate isobject isquery issimplevalue issoaprequest &quot;+&quot;isstruct isuserinrole isvalid isvalid isvalid iswddx isxml &quot;+&quot;isxmlattribute isxmldoc isxmlelem isxmlnode isxmlroot javacast &quot;+&quot;jsstringformat lcase left len listappend listchangedelims listcontains &quot;+&quot;listcontainsnocase listdeleteat listfind listfindnocase listfirst &quot;+&quot;listgetat listinsertat listlast listlen listprepend listqualify &quot;+&quot;listrest listsetat listsort listtoarray listvaluecount &quot;+&quot;listvaluecountnocase ljustify log log10 lscurrencyformat lsdateformat &quot;+&quot;lseurocurrencyformat lsiscurrency lsisdate lsisnumeric lsnumberformat &quot;+&quot;lsparsecurrency lsparsedatetime lsparseeurocurrency lsparsenumber &quot;+&quot;lstimeformat ltrim max mid min minute month monthasstring now &quot;+&quot;numberformat paragraphformat parameterexists parsedatetime pi &quot;+&quot;preservesinglequotes quarter queryaddcolumn queryaddrow querynew &quot;+&quot;querysetcell quotedvaluelist rand randomize randrange refind &quot;+&quot;refindnocase releasecomobject removechars repeatstring replace &quot;+&quot;replacelist replacenocase rereplace rereplacenocase reverse right &quot;+&quot;rjustify round rtrim second sendgatewaymessage setencoding &quot;+&quot;setlocale setprofilestring setvariable sgn sin spanexcluding &quot;+&quot;spanincluding sqr stripcr structappend structclear structcopy &quot;+&quot;structcount structdelete structfind structfindkey structfindvalue &quot;+&quot;structget structinsert structisempty structkeyarray structkeyexists &quot;+&quot;structkeylist structnew structsort structupdate tan timeformat &quot;+&quot;tobase64 tobinary toscript tostring trim ucase urldecode urlencodedformat &quot;+&quot;urlsessionformat val valuelist week wrap writeoutput xmlchildpos &quot;+&quot;xmlelemnew xmlformat xmlgetnodetype xmlnew xmlparse xmlsearch xmltransform &quot;+&quot;xmlvalidate year yesnoformat&quot;;this.stringMatches=new Array();this.attributeMatches=new Array()};dp.sh.Brushes.ColdFusion.prototype=new dp.sh.Highlighter();dp.sh.Brushes.ColdFusion.Aliases=[&quot;coldfusion&quot;,&quot;cf&quot;];dp.sh.Brushes.ColdFusion.prototype.ProcessRegexList=function(){function B(_,$){_[_.length]=$}function A(A,$){for(var _=0;_&lt;A.length;_++)if(A[_]==$)return _;return-1}var _=null,$=null;this.GetMatches(new RegExp(&quot;\\b(\\d+)&quot;,&quot;gm&quot;),&quot;numbers&quot;);this.GetMatches(new RegExp(this.GetKeywords(this.mgKeywords),&quot;igm&quot;),&quot;mgkeywords&quot;);this.GetMatches(dp.sh.RegexLib.SingleLineCComments,&quot;cfscriptcomments&quot;);this.GetMatches(dp.sh.RegexLib.MultiLineCComments,&quot;cfscriptcomments&quot;);this.GetMatches(new RegExp(&quot;(&amp;lt;|&lt;)!---[\\s\\S]*?---(&amp;gt;|&gt;)&quot;,&quot;gm&quot;),&quot;cfcomments&quot;);$=new RegExp(&quot;(cfset\\s*)?([:\\w-.]+)\\s*=\\s*(\&quot;.*?\&quot;|'.*?')*&quot;,&quot;gm&quot;);while((_=$.exec(this.code))!=null){if(_[1]!=undefined&amp;&amp;_[1]!=&quot;&quot;)continue;if(_[3]!=undefined&amp;&amp;_[3]!=&quot;&quot;&amp;&amp;_[3]!=&quot;\&quot;\&quot;&quot;&amp;&amp;_[3]!=&quot;''&quot;){B(this.matches,new dp.sh.Match(_[2],_.index,&quot;attribute&quot;));B(this.matches,new dp.sh.Match(_[3],_.index+_[0].indexOf(_[3]),&quot;attribute-value&quot;));B(this.stringMatches,_[3]);B(this.attributeMatches,_[2])}}this.GetMatches(new RegExp(&quot;(&amp;lt;|&lt;)/*\\?*(?!\\!)|/*\\?*(&amp;gt;|&gt;)&quot;,&quot;gm&quot;),&quot;tag&quot;);$=new RegExp(&quot;(?:&amp;lt;|&lt;)/*\\?*\\s*([:\\w-.]+)&quot;,&quot;gm&quot;);while((_=$.exec(this.code))!=null)B(this.matches,new dp.sh.Match(_[1],_.index+_[0].indexOf(_[1]),&quot;tag-name&quot;));$=new RegExp(this.GetKeywords(this.keywords),&quot;igm&quot;);while((_=$.exec(this.code))!=null)if(A(this.attributeMatches,_[0])==-1)B(this.matches,new dp.sh.Match(_[0],_.index,&quot;keywords&quot;));$=new RegExp(&quot;cfset\\s*.*(\&quot;.*?\&quot;|'.*?')&quot;,&quot;gm&quot;);while((_=$.exec(this.code))!=null)if(_[1]!=undefined&amp;&amp;_[1]!=&quot;&quot;){B(this.matches,new dp.sh.Match(_[1],_.index+_[0].indexOf(_[1]),&quot;strings&quot;));B(this.stringMatches,_[1])}while((_=dp.sh.RegexLib.DoubleQuotedString.exec(this.code))!=null)if(A(this.stringMatches,_[0])==-1)B(this.matches,new dp.sh.Match(_[0],_.index,&quot;strings&quot;));while((_=dp.sh.RegexLib.SingleQuotedString.exec(this.code))!=null)if(A(this.stringMatches,_[0])==-1)B(this.matches,new dp.sh.Match(_[0],_.index,&quot;strings&quot;))};dp.sh.Brushes.Cpp=function(){var _=&quot;ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR &quot;+&quot;DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH &quot;+&quot;HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP &quot;+&quot;HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY &quot;+&quot;HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT &quot;+&quot;HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE &quot;+&quot;LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF &quot;+&quot;LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR &quot;+&quot;LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR &quot;+&quot;PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT &quot;+&quot;PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 &quot;+&quot;POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR &quot;+&quot;PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 &quot;+&quot;PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT &quot;+&quot;SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG &quot;+&quot;ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM &quot;+&quot;char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t &quot;+&quot;clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS &quot;+&quot;FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t &quot;+&quot;__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t &quot;+&quot;jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler &quot;+&quot;sig_atomic_t size_t _stat __stat64 _stati64 terminate_function &quot;+&quot;time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf &quot;+&quot;va_list wchar_t wctrans_t wctype_t wint_t signed&quot;,$=&quot;break case catch class const __finally __exception __try &quot;+&quot;const_cast continue private public protected __declspec &quot;+&quot;default delete deprecated dllexport dllimport do dynamic_cast &quot;+&quot;else enum explicit extern if for friend goto inline &quot;+&quot;mutable naked namespace new noinline noreturn nothrow &quot;+&quot;register reinterpret_cast return selectany &quot;+&quot;sizeof static static_cast struct switch template this &quot;+&quot;thread throw true false try typedef typeid typename union &quot;+&quot;using uuid virtual void volatile whcar_t while&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.MultiLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;^ *#.*&quot;,&quot;gm&quot;),css:&quot;preprocessor&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gm&quot;),css:&quot;datatypes&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-cpp&quot;;this.Style=&quot;.dp-cpp .datatypes { color: #2E8B57; font-weight: bold; }&quot;};dp.sh.Brushes.Cpp.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Cpp.Aliases=[&quot;cpp&quot;,&quot;c&quot;,&quot;c++&quot;];dp.sh.Brushes.CSharp=function(){var $=&quot;abstract as base bool break byte case catch char checked class const &quot;+&quot;continue decimal default delegate do double else enum event explicit &quot;+&quot;extern false finally fixed float for foreach get goto if implicit in int &quot;+&quot;interface internal is lock long namespace new null object operator out &quot;+&quot;override params private protected public readonly ref return sbyte sealed set &quot;+&quot;short sizeof stackalloc static string struct switch this throw true try &quot;+&quot;typeof uint ulong unchecked unsafe ushort using virtual void while&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.MultiLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;^\\s*#.*&quot;,&quot;gm&quot;),css:&quot;preprocessor&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-c&quot;;this.Style=&quot;.dp-c .vars { color: #d00; }&quot;};dp.sh.Brushes.CSharp.prototype=new dp.sh.Highlighter();dp.sh.Brushes.CSharp.Aliases=[&quot;c#&quot;,&quot;c-sharp&quot;,&quot;csharp&quot;];dp.sh.Brushes.CSS=function(){var _=&quot;ascent azimuth background-attachment background-color background-image background-position &quot;+&quot;background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top &quot;+&quot;border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color &quot;+&quot;border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width &quot;+&quot;border-bottom-width border-left-width border-width border cap-height caption-side centerline clear clip color &quot;+&quot;content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display &quot;+&quot;elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font &quot;+&quot;height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top &quot;+&quot;margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans &quot;+&quot;outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page &quot;+&quot;page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position &quot;+&quot;quotes richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress &quot;+&quot;table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em &quot;+&quot;vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index&quot;,$=&quot;above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder &quot;+&quot;both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed &quot;+&quot;continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double &quot;+&quot;embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia &quot;+&quot;gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic &quot;+&quot;justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha &quot;+&quot;lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower &quot;+&quot;navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset &quot;+&quot;outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side &quot;+&quot;rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow &quot;+&quot;small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize &quot;+&quot;table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal &quot;+&quot;text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin &quot;+&quot;upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow&quot;,A=&quot;[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif&quot;;this.regexList=[{regex:dp.sh.RegexLib.MultiLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;\\#[a-zA-Z0-9]{3,6}&quot;,&quot;g&quot;),css:&quot;value&quot;},{regex:new RegExp(&quot;(-?\\d+)(.\\d+)?(px|em|pt|:|%|)&quot;,&quot;g&quot;),css:&quot;value&quot;},{regex:new RegExp(&quot;!important&quot;,&quot;g&quot;),css:&quot;important&quot;},{regex:new RegExp(this.GetKeywordsCSS(_),&quot;gm&quot;),css:&quot;keyword&quot;},{regex:new RegExp(this.GetValuesCSS($),&quot;g&quot;),css:&quot;value&quot;},{regex:new RegExp(this.GetValuesCSS(A),&quot;g&quot;),css:&quot;value&quot;}];this.CssClass=&quot;dp-css&quot;;this.Style=&quot;.dp-css .value { color: black; }&quot;+&quot;.dp-css .important { color: red; }&quot;};dp.sh.Highlighter.prototype.GetKeywordsCSS=function($){return&quot;\\b([a-z_]|)&quot;+$.replace(/ /g,&quot;(?=:)\\b|\\b([a-z_\\*]|\\*|)&quot;)+&quot;(?=:)\\b&quot;};dp.sh.Highlighter.prototype.GetValuesCSS=function($){return&quot;\\b&quot;+$.replace(/ /g,&quot;(?!-)(?!:)\\b|\\b()&quot;)+&quot;:\\b&quot;};dp.sh.Brushes.CSS.prototype=new dp.sh.Highlighter();dp.sh.Brushes.CSS.Aliases=[&quot;css&quot;];dp.sh.Brushes.Delphi=function(){var $=&quot;abs addr and ansichar ansistring array as asm begin boolean byte cardinal &quot;+&quot;case char class comp const constructor currency destructor div do double &quot;+&quot;downto else end except exports extended false file finalization finally &quot;+&quot;for function goto if implementation in inherited int64 initialization &quot;+&quot;integer interface is label library longint longword mod nil not object &quot;+&quot;of on or packed pansichar pansistring pchar pcurrency pdatetime pextended &quot;+&quot;pint64 pointer private procedure program property pshortstring pstring &quot;+&quot;pvariant pwidechar pwidestring protected public published raise real real48 &quot;+&quot;record repeat set shl shortint shortstring shr single smallint string then &quot;+&quot;threadvar to true try type unit until uses val var varirnt while widechar &quot;+&quot;widestring with word write writeln xor&quot;;this.regexList=[{regex:new RegExp(&quot;\\(\\*[\\s\\S]*?\\*\\)&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:new RegExp(&quot;{(?!\\$)[\\s\\S]*?}&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:dp.sh.RegexLib.SingleLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;\\{\\$[a-zA-Z]+ .+\\}&quot;,&quot;g&quot;),css:&quot;directive&quot;},{regex:new RegExp(&quot;\\b[\\d\\.]+\\b&quot;,&quot;g&quot;),css:&quot;number&quot;},{regex:new RegExp(&quot;\\$[a-zA-Z0-9]+\\b&quot;,&quot;g&quot;),css:&quot;number&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-delphi&quot;;this.Style=&quot;.dp-delphi .number { color: blue; }&quot;+&quot;.dp-delphi .directive { color: #008284; }&quot;+&quot;.dp-delphi .vars { color: #000; }&quot;};dp.sh.Brushes.Delphi.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Delphi.Aliases=[&quot;delphi&quot;,&quot;pascal&quot;];dp.sh.Brushes.Java=function(){var $=&quot;abstract assert boolean break byte case catch char class const &quot;+&quot;continue default do double else enum extends &quot;+&quot;false final finally float for goto if implements import &quot;+&quot;instanceof int interface long native new null &quot;+&quot;package private protected public return &quot;+&quot;short static strictfp super switch synchronized this throw throws true &quot;+&quot;transient try void volatile while&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.MultiLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b&quot;,&quot;gi&quot;),css:&quot;number&quot;},{regex:new RegExp(&quot;(?!\\@interface\\b)\\@[\\$\\w]+\\b&quot;,&quot;g&quot;),css:&quot;annotation&quot;},{regex:new RegExp(&quot;\\@interface\\b&quot;,&quot;g&quot;),css:&quot;keyword&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-j&quot;;this.Style=&quot;.dp-j .annotation { color: #646464; }&quot;+&quot;.dp-j .number { color: #C00000; }&quot;};dp.sh.Brushes.Java.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Java.Aliases=[&quot;java&quot;];dp.sh.Brushes.JScript=function(){var $=&quot;abstract boolean break byte case catch char class const continue debugger &quot;+&quot;default delete do double else enum export extends false final finally float &quot;+&quot;for function goto if implements import in instanceof int interface long native &quot;+&quot;new null package private protected public return short static super switch &quot;+&quot;synchronized this throw throws transient true try typeof var void volatile while with&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.MultiLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;^\\s*#.*&quot;,&quot;gm&quot;),css:&quot;preprocessor&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-c&quot;};dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter();dp.sh.Brushes.JScript.Aliases=[&quot;js&quot;,&quot;jscript&quot;,&quot;javascript&quot;];dp.sh.Brushes.Lua=function(){var $=&quot;break do end else elseif function if local nil not or repeat return and then until while this&quot;,_=&quot;math\\.\\w+ string\\.\\w+ os\\.\\w+ debug\\.\\w+ io\\.\\w+ error fopen dofile coroutine\\.\\w+ arg getmetatable ipairs loadfile loadlib loadstring longjmp print rawget rawset seek setmetatable assert tonumber tostring&quot;;this.regexList=[{regex:new RegExp(&quot;--\\[\\[[\\s\\S]*\\]\\]--&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:new RegExp(&quot;--[^\\[]{2}.*$&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gm&quot;),css:&quot;func&quot;},];this.CssClass=&quot;dp-lua&quot;};dp.sh.Brushes.Lua.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Lua.Aliases=[&quot;lua&quot;];dp.sh.Brushes.Mxml=function(){this.CssClass=&quot;dp-mxml&quot;;this.Style=&quot;.dp-mxml .cdata { color: #000000; }&quot;+&quot;.dp-mxml .tag { color : #0000ff; }&quot;+&quot;.dp-mxml .tag-name { color: #0000ff; }&quot;+&quot;.dp-mxml .script { color: green; }&quot;+&quot;.dp-mxml .metadata { color: green; }&quot;+&quot;.dp-mxml .attribute { color: #000000; }&quot;+&quot;.dp-mxml .attribute-value { color: #990000; }&quot;+&quot;.dp-mxml .trace { color: #cc6666; }&quot;+&quot;.dp-mxml .var { color: #6699cc; }&quot;+&quot;.dp-mxml .comment { color: #009900; }&quot;+&quot;.dp-mxml .string { color: #990000; }&quot;+&quot;.dp-mxml .keyword { color: blue; }&quot;};dp.sh.Brushes.Mxml.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Mxml.Aliases=[&quot;mxml&quot;];dp.sh.Brushes.Mxml.prototype.ProcessRegexList=function(){function H(_,$){_[_.length]=$}function B(B,_){var A=0,$=false;for(A=0;A&lt;B.length;A++)if(_.index&gt;B[A].firstIndex&amp;&amp;_.index&lt;B[A].lastIndex)$=true;return $}var $=0,F=null,D=null,A=null,C=&quot;&quot;,E=new Array(),_=&quot;abstract boolean break byte case catch char class const continue debugger &quot;+&quot;default delete do double else enum export extends false final finally float &quot;+&quot;for function goto if implements import in instanceof int interface long native &quot;+&quot;new null package private protected public return short static super switch &quot;+&quot;synchronized this throw throws transient true try typeof var void volatile while with&quot;,G=[{regex:dp.sh.RegexLib.SingleLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.MultiLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;^\\s*#.*&quot;,&quot;gm&quot;),css:&quot;preprocessor&quot;},{regex:new RegExp(this.GetKeywords(&quot;trace&quot;),&quot;gm&quot;),css:&quot;trace&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gm&quot;),css:&quot;keyword&quot;}];A=new RegExp(&quot;&amp;lt;\\!\\[CDATA\\[(.|\\s)*?\\]\\]&amp;gt;&quot;,&quot;gm&quot;);while((F=A.exec(this.code))!=null){C=F[0].substr(0,12);H(this.matches,new dp.sh.Match(C,F.index,&quot;cdata&quot;));C=F[0].substr(12,F[0].length-12-6);for(var I=0;I&lt;G.length;I++)while((D=G[I].regex.exec(C))!=null)H(this.matches,new dp.sh.Match(D[0],F.index+12+D.index,G[I].css));C=F[0].substr(F[0].length-6,6);H(this.matches,new dp.sh.Match(C,F.index+F[0].length-6,&quot;cdata&quot;));E.push({firstIndex:F.index,lastIndex:F.index+F[0].length-1})}this.GetMatches(new RegExp(&quot;(&amp;lt;|&lt;)!--\\s*.*?\\s*--(&amp;gt;|&gt;)&quot;,&quot;gm&quot;),&quot;comments&quot;);A=new RegExp(&quot;([:\\w-.]+)\\s*=\\s*(\&quot;.*?\&quot;|'.*?'|\\w+)*|(\\w+)&quot;,&quot;gm&quot;);while((F=A.exec(this.code))!=null){if(F[1]==null)continue;if(B(E,F))continue;H(this.matches,new dp.sh.Match(F[1],F.index,&quot;attribute&quot;));if(F[2]!=undefined)H(this.matches,new dp.sh.Match(F[2],F.index+F[0].indexOf(F[2]),&quot;attribute-value&quot;))}A=new RegExp(&quot;(?:&amp;lt;|&lt;)/*\\?*\\s*([:\\w-.]+)&quot;,&quot;gm&quot;);while((F=A.exec(this.code))!=null){if(B(E,F))continue;C=F[0].substr(4,F[0].length-4);switch(C){case&quot;mx:Script&quot;:case&quot;/mx:Script&quot;:H(this.matches,new dp.sh.Match(F[0]+&quot;&amp;gt;&quot;,F.index,&quot;script&quot;));break;case&quot;mx:Metadata&quot;:case&quot;/mx:Metadata&quot;:H(this.matches,new dp.sh.Match(F[0]+&quot;&amp;gt;&quot;,F.index,&quot;metadata&quot;));break;default:H(this.matches,new dp.sh.Match(F[0],F.index,&quot;tag-name&quot;));break}}A=new RegExp(&quot;\\?&amp;gt;|&amp;gt;|/&amp;gt;&quot;,&quot;gm&quot;);while((F=A.exec(this.code))!=null){if(B(E,F))continue;H(this.matches,new dp.sh.Match(F[0],F.index,&quot;tag&quot;))}};dp.sh.Brushes.Perl=function(){var _=&quot;abs accept alarm atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir connect cos crypt dbmclose dbmopen defined delete dump each endgrent endhostent endnetent endprotoent endpwent endservent eof exec exists exp fcntl fileno flock fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime grep hex import index int ioctl join keys kill lc lcfirst length link listen localtime lock log lstat m map mkdir msgctl msgget msgrcv msgsnd no oct open opendir ord pack pipe pop pos print printf prototype push q qq quotemeta qw qx rand read readdir readline readlink readpipe recv ref rename reset reverse rewinddir rindex rmdir scalar seek seekdir semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unlink unpack unshift untie utime values vec waitpid wantarray warn write qr&quot;,$=&quot;s select goto die do package redo require return continue for foreach last next wait while use if else elsif eval exit unless switch case&quot;,A=&quot;my our local&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;(\\$|@|%)\\w+&quot;,&quot;g&quot;),css:&quot;vars&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gmi&quot;),css:&quot;func&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;},{regex:new RegExp(this.GetKeywords(A),&quot;gm&quot;),css:&quot;declarations&quot;}];this.CssClass=&quot;dp-perl&quot;};dp.sh.Brushes.Perl.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Perl.Aliases=[&quot;perl&quot;];dp.sh.Brushes.Php=function(){var _=&quot;abs acos acosh addcslashes addslashes &quot;+&quot;array_change_key_case array_chunk array_combine array_count_values array_diff &quot;+&quot;array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill &quot;+&quot;array_filter array_flip array_intersect array_intersect_assoc array_intersect_key &quot;+&quot;array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map &quot;+&quot;array_merge array_merge_recursive array_multisort array_pad array_pop array_product &quot;+&quot;array_push array_rand array_reduce array_reverse array_search array_shift &quot;+&quot;array_slice array_splice array_sum array_udiff array_udiff_assoc &quot;+&quot;array_udiff_uassoc array_uintersect array_uintersect_assoc &quot;+&quot;array_uintersect_uassoc array_unique array_unshift array_values array_walk &quot;+&quot;array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert &quot;+&quot;basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress &quot;+&quot;bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir &quot;+&quot;checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists &quot;+&quot;closedir closelog copy cos cosh count count_chars date decbin dechex decoct &quot;+&quot;deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log &quot;+&quot;error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded &quot;+&quot;feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents &quot;+&quot;fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype &quot;+&quot;floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf &quot;+&quot;fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname &quot;+&quot;gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt &quot;+&quot;getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext &quot;+&quot;gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set &quot;+&quot;interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double &quot;+&quot;is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long &quot;+&quot;is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault &quot;+&quot;is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br &quot;+&quot;parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir &quot;+&quot;round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split &quot;+&quot;str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes &quot;+&quot;stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk &quot;+&quot;strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime &quot;+&quot;strtoupper strtr strval substr substr_compare&quot;,$=&quot;and or xor __FILE__ __LINE__ array as break case &quot;+&quot;cfunction class const continue declare default die do else &quot;+&quot;elseif empty enddeclare endfor endforeach endif endswitch endwhile &quot;+&quot;extends for foreach function include include_once global if &quot;+&quot;new old_function return static switch use require require_once &quot;+&quot;var while __FUNCTION__ __CLASS__ &quot;+&quot;__METHOD__ abstract interface public implements extends private protected throw&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.MultiLineCComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;\\$\\w+&quot;,&quot;g&quot;),css:&quot;vars&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gmi&quot;),css:&quot;func&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-c&quot;};dp.sh.Brushes.Php.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Php.Aliases=[&quot;php&quot;];dp.sh.Brushes.Python=function(){var $=&quot;and assert break class continue def del elif else &quot;+&quot;except exec finally for from global if import in is &quot;+&quot;lambda not or pass print raise return try yield while&quot;,_=&quot;None True False self cls class_&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:&quot;comment&quot;},{regex:new RegExp(&quot;^\\s*@\\w+&quot;,&quot;gm&quot;),css:&quot;decorator&quot;},{regex:new RegExp(&quot;(['\&quot;]{3})([^\\1])*?\\1&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:new RegExp(&quot;\&quot;(?!\&quot;)(?:\\.|\\\\\\\&quot;|[^\\\&quot;\&quot;\\n\\r])*\&quot;&quot;,&quot;gm&quot;),css:&quot;string&quot;},{regex:new RegExp(&quot;'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'&quot;,&quot;gm&quot;),css:&quot;string&quot;},{regex:new RegExp(&quot;\\b\\d+\\.?\\w*&quot;,&quot;g&quot;),css:&quot;number&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gm&quot;),css:&quot;special&quot;}];this.CssClass=&quot;dp-py&quot;;this.Style=&quot;.dp-py .builtins { color: #ff1493; }&quot;+&quot;.dp-py .magicmethods { color: #808080; }&quot;+&quot;.dp-py .exceptions { color: brown; }&quot;+&quot;.dp-py .types { color: brown; font-style: italic; }&quot;+&quot;.dp-py .commonlibs { color: #8A2BE2; font-style: italic; }&quot;};dp.sh.Brushes.Python.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Python.Aliases=[&quot;py&quot;,&quot;python&quot;];dp.sh.Brushes.Ruby=function(){var $=&quot;alias and BEGIN begin break case class def define_method defined do each else elsif &quot;+&quot;END end ensure false for if in module new next nil not or raise redo rescue retry return &quot;+&quot;self super then throw true undef unless until when while yield&quot;,_=&quot;Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload &quot;+&quot;Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol &quot;+&quot;ThreadGroup Thread Time TrueClass&quot;;this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;:[a-z][A-Za-z0-9_]*&quot;,&quot;g&quot;),css:&quot;symbol&quot;},{regex:new RegExp(&quot;(\\$|@@|@)\\w+&quot;,&quot;g&quot;),css:&quot;variable&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gm&quot;),css:&quot;builtin&quot;}];this.CssClass=&quot;dp-rb&quot;;this.Style=&quot;.dp-rb .symbol { color: #a70; }&quot;+&quot;.dp-rb .variable { color: #a70; font-weight: bold; }&quot;};dp.sh.Brushes.Ruby.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Ruby.Aliases=[&quot;ruby&quot;,&quot;rails&quot;,&quot;ror&quot;];dp.sh.Brushes.Sql=function(){var _=&quot;abs avg case cast coalesce convert count current_timestamp &quot;+&quot;current_user day isnull left lower month nullif replace right &quot;+&quot;session_user space substring sum system_user upper user year&quot;,$=&quot;absolute action add after alter as asc at authorization begin bigint &quot;+&quot;binary bit by cascade char character check checkpoint close collate &quot;+&quot;column commit committed connect connection constraint contains continue &quot;+&quot;create cube current current_date current_time cursor database date &quot;+&quot;deallocate dec decimal declare default delete desc distinct double drop &quot;+&quot;dynamic else end end-exec escape except exec execute false fetch first &quot;+&quot;float for force foreign forward free from full function global goto grant &quot;+&quot;group grouping having hour ignore index inner insensitive insert instead &quot;+&quot;int integer intersect into is isolation key last level load local max min &quot;+&quot;minute modify move name national nchar next no numeric of off on only &quot;+&quot;open option order out output partial password precision prepare primary &quot;+&quot;prior privileges procedure public read real references relative repeatable &quot;+&quot;restrict return returns revoke rollback rollup rows rule schema scroll &quot;+&quot;second section select sequence serializable set size smallint static &quot;+&quot;statistics table temp temporary then time timestamp to top transaction &quot;+&quot;translation trigger true truncate uncommitted union unique update values &quot;+&quot;varchar varying view when where with work&quot;,A=&quot;all and any between cross in join like not null or outer some&quot;;this.regexList=[{regex:new RegExp(&quot;--(.*)$&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:dp.sh.RegexLib.SingleQuotedString,css:&quot;string&quot;},{regex:new RegExp(this.GetKeywords(_),&quot;gmi&quot;),css:&quot;func&quot;},{regex:new RegExp(this.GetKeywords(A),&quot;gmi&quot;),css:&quot;op&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gmi&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-sql&quot;;this.Style=&quot;.dp-sql .func { color: #ff1493; }&quot;+&quot;.dp-sql .op { color: #808080; }&quot;};dp.sh.Brushes.Sql.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Sql.Aliases=[&quot;sql&quot;];dp.sh.Brushes.Vb=function(){var $=&quot;AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto &quot;+&quot;Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate &quot;+&quot;CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType &quot;+&quot;Date Decimal Declare Default Delegate Dim DirectCast Do Double Each &quot;+&quot;Else ElseIf End Enum Erase Error Event Exit False Finally For Friend &quot;+&quot;Function Get GetType GoSub GoTo Handles If Implements Imports In &quot;+&quot;Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module &quot;+&quot;MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing &quot;+&quot;NotInheritable NotOverridable Object On Option Optional Or OrElse &quot;+&quot;Overloads Overridable Overrides ParamArray Preserve Private Property &quot;+&quot;Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume &quot;+&quot;Return Select Set Shadows Shared Short Single Static Step Stop String &quot;+&quot;Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until &quot;+&quot;Variant When While With WithEvents WriteOnly Xor&quot;;this.regexList=[{regex:new RegExp(&quot;'.*$&quot;,&quot;gm&quot;),css:&quot;comment&quot;},{regex:dp.sh.RegexLib.DoubleQuotedString,css:&quot;string&quot;},{regex:new RegExp(&quot;^\\s*#.*&quot;,&quot;gm&quot;),css:&quot;preprocessor&quot;},{regex:new RegExp(this.GetKeywords($),&quot;gm&quot;),css:&quot;keyword&quot;}];this.CssClass=&quot;dp-vb&quot;};dp.sh.Brushes.Vb.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Vb.Aliases=[&quot;vb&quot;,&quot;vb.net&quot;];dp.sh.Brushes.Xml=function(){this.CssClass=&quot;dp-xml&quot;;this.Style=&quot;.dp-xml .cdata { color: #ff1493; }&quot;+&quot;.dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }&quot;+&quot;.dp-xml .attribute { color: red; }&quot;+&quot;.dp-xml .attribute-value { color: blue; }&quot;};dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Xml.Aliases=[&quot;xml&quot;,&quot;xhtml&quot;,&quot;xslt&quot;,&quot;html&quot;,&quot;xhtml&quot;];dp.sh.Brushes.Xml.prototype.ProcessRegexList=function(){function B(_,$){_[_.length]=$}var $=0,A=null,_=null;this.GetMatches(new RegExp(&quot;(&amp;lt;|&lt;)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](&amp;gt;|&gt;)&quot;,&quot;gm&quot;),&quot;cdata&quot;);this.GetMatches(new RegExp(&quot;(&amp;lt;|&lt;)!--\\s*.*?\\s*--(&amp;gt;|&gt;)&quot;,&quot;gm&quot;),&quot;comments&quot;);_=new RegExp(&quot;([:\\w-.]+)\\s*=\\s*(\&quot;.*?\&quot;|'.*?'|\\w+)*|(\\w+)&quot;,&quot;gm&quot;);while((A=_.exec(this.code))!=null){if(A[1]==null)continue;B(this.matches,new dp.sh.Match(A[1],A.index,&quot;attribute&quot;));if(A[2]!=undefined)B(this.matches,new dp.sh.Match(A[2],A.index+A[0].indexOf(A[2]),&quot;attribute-value&quot;))}this.GetMatches(new RegExp(&quot;(&amp;lt;|&lt;)/*\\?*(?!\\!)|/*\\?*(&amp;gt;|&gt;)&quot;,&quot;gm&quot;),&quot;tag&quot;);_=new RegExp(&quot;(?:&amp;lt;|&lt;)/*\\?*\\s*([:\\w-.]+)&quot;,&quot;gm&quot;);while((A=_.exec(this.code))!=null)B(this.matches,new dp.sh.Match(A[1],A.index+A[0].indexOf(A[1]),&quot;tag-name&quot;))}
//}}}</pre>
</div>
<div title="TiddlerTweakerPlugin" modifier="escdie" created="201009101359" modified="201011101813" tags="systemConfig plugin pluginInfo %tw-elnb">
<pre>/***
|Name|TiddlerTweakerPlugin|
|Source|http://www.TiddlyTools.com/#TiddlerTweakerPlugin|
|Version|2.4.4|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|select multiple tiddlers and modify author, created, modified and/or tag values|
~TiddlerTweaker is a 'power tool' for TiddlyWiki authors.  Select multiple tiddlers from a listbox and 'bulk modify' the creator, author, created, modified and/or tag values of those tiddlers using a compact set of form fields.  The values you enter into the fields simultaneously overwrite the existing values in all tiddlers you have selected.
!!!!!Usage
&lt;&lt;&lt;
{{{&lt;&lt;tiddlerTweaker&gt;&gt;}}}
{{smallform{&lt;&lt;tiddlerTweaker&gt;&gt;}}}
By default, any tags you enter into the TiddlerTweaker will //replace// the existing tags in all the tiddlers you have selected.  However, you can also use TiddlerTweaker to quickly filter specified tags from the selected tiddlers, while leaving any other tags assigned to those tiddlers unchanged:
&gt;Any tag preceded by a '+' (plus) or '-' (minus), will be added or removed from the existing tags //instead of replacing the entire tag definition// of each tiddler (e.g., enter '-excludeLists' to remove that tag from all selected tiddlers.  When using this syntax, care should be taken to ensure that //every// tag is preceded by '+' or '-', to avoid inadvertently overwriting any other existing tags on the selected tiddlers.  (note: the '+' or '-' prefix on each tag value is NOT part of the tag value, and is only used by TiddlerTweaker to control how that tag value is processed)
Important Notes:
* TiddlerTweaker is a 'power user' tool that can make changes to many tiddlers at once.  ''You should always have a recent backup of your document (or 'save changes' just *before* tweaking the tiddlers), just in case you accidentally 'shoot yourself in the foot'.''
* The date and author information on any tiddlers you tweak will ONLY be updated if the corresponding checkboxes have been selected.  As a general rule, after using TiddlerTweaker, always ''//remember to save your document//'' when you are done, even though the tiddler timeline tab may not show any recently modified tiddlers.
* Selecting and updating all tiddlers in a document can take a while.  Your browser may warn about an 'unresponsive script'.  Usually, if you allow it to continue, it should complete the processing... eventually.  Nonetheless, be sure to save your work before you begin tweaking lots of tiddlers, just in case something does get stuck.
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.09.15 2.4.4 added 'edit' button. moved html definition to separate section
2009.09.13 2.4.3 in settiddlers(), convert backslashed chars (\n\b\s\t) in replacement text
2009.06.26 2.4.2 only add brackets around tags containing spaces
2009.06.22 2.4.1 in setFields(), add brackets around all tags shown tweaker edit field
2009.03.30 2.4.0 added 'sort by modifier'
2009.01.22 2.3.0 added support for text pattern find/replace
2008.10.27 2.2.3 in setTiddlers(), fixed Safari bug by replacing static Array.concat(...) with new Array().concat(...)
2008.09.07 2.2.2 added removeCookie() function for compatibility with [[CookieManagerPlugin]]
2008.05.12 2.2.1 replace built-in backstage tweak task with tiddler tweaker control panel (moved from BackstageTweaks)
2008.01.13 2.2.0 added 'auto-selection' links: all, changed, tags, title, text
2007.12.26 2.1.0 added support for managing 'creator' custom field (see [[CoreTweaks]])
2007.11.01 2.0.3 added config.options.txtTweakerSortBy for cookie-based persistence of list display order preference setting.
2007.09.28 2.0.2 in settiddlers() and deltiddlers(), added suspend/resume notification handling (improves performance when operating on multiple tiddlers)
2007.08.03 2.0.1 added shadow definition for [[TiddlerTweaker]] tiddler for use as parameter references with {{{&lt;&lt;tiddler&gt;&gt;, &lt;&lt;slider&gt;&gt; or &lt;&lt;tabs&gt;&gt;}}} macros.
2007.08.03 2.0.0 converted from inline script
2006.01.01 1.0.0 initial release
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.TiddlerTweakerPlugin= {major: 2, minor: 4, revision: 4, date: new Date(2009,9,15)};

// shadow tiddler
config.shadowTiddlers.TiddlerTweaker='&lt;&lt;tiddlerTweaker&gt;&gt;';

// defaults
if (config.options.txtTweakerSortBy==undefined) config.options.txtTweakerSortBy='modified';

// backstage task
if (config.tasks) { // for TW2.2b3 or above
	config.tasks.tweak.tooltip='review/modify tiddler internals: dates, authors, tags, etc.';
	config.tasks.tweak.content='{{smallform small groupbox{&lt;&lt;tiddlerTweaker&gt;&gt;}}}';
}

// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

config.macros.tiddlerTweaker = {
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var span=createTiddlyElement(place,'span');
		span.innerHTML=store.getTiddlerText('TiddlerTweakerPlugin##html');
		this.init(span.getElementsByTagName('form')[0],config.options.txtTweakerSortBy);
	},
	init: function(f,sortby) { // initialize form controls
		if (!f) return; // form might not be rendered yet...
		while (f.list.options[0]) f.list.options[0]=null; // empty current list content
		var tids=store.getTiddlers(sortby);
		if (sortby=='size') // descending order
			tids.sort(function(a,b) {return a.text.length &gt; b.text.length ? -1 : (a.text.length == b.text.length ? 0 : +1);});
		var who='';
		for (i=0; i&lt;tids.length; i++) { var t=tids[i];
			var label=t.title; var value=t.title;
			switch (sortby) {
				case 'modified':
				case 'created':
					var t=tids[tids.length-i-1]; // reverse order
					var when=t[sortby].formatString('YY.0MM.0DD 0hh:0mm ');
					label=when+t.title;
					value=t.title;
					break;
				case 'size':
					label='['+t.text.length+'] '+label;
					break;
				case 'modifier':
				case 'creator':
					if (who!=t[sortby]) {
						who=t[sortby];
						f.list.options[f.list.length]=new Option('by '+who+':','',false,false);
					}
					label='\xa0\xa0\xa0'+label; // indent
					break;
			}
			f.list.options[f.list.length]=new Option(label,value,false,false);
		}
		f.title.value=f.who.value=f.creator.value=f.tags.value='';
		f.cm.value=f.cd.value=f.cy.value=f.ch.value=f.cn.value='';
		f.mm.value=f.md.value=f.my.value=f.mh.value=f.mn.value='';
		f.stats.disabled=f.set.disabled=f.del.disabled=f.edit.disabled=f.display.disabled=true;
		f.settitle.disabled=false;
		config.options.txtTweakerSortBy=sortby;
		f.sortby.value=sortby; // sync droplist
		if (sortby!='modified') saveOptionCookie('txtTweakerSortBy');
		else removeCookie('txtTweakerSortBy');
	},
	selecttiddlers: function(here) { // enables/disables inputs based on #items selected
		var f=here.form; var list=f.list;
		var c=0; for (i=0;i&lt;list.length;i++) if (list.options[i].selected) c++;
		if (c&gt;1) f.title.disabled=true;
		if (c&gt;1) f.settitle.checked=false;
		f.set.disabled=(c==0);
		f.del.disabled=(c==0);
		f.edit.disabled=(c==0);
		f.display.disabled=(c==0);
		f.settitle.disabled=(c&gt;1);
		f.stats.disabled=(c==0);
		var msg=(c==0)?'select tiddlers':(c+' tiddler'+(c!=1?'s':'')+' selected');
		here.previousSibling.firstChild.firstChild.nextSibling.innerHTML=msg;
		if (c) clearMessage(); else displayMessage('no tiddlers selected');
	},
	setfields: function(here) { // set fields from first selected tiddler
		var f=here.form;
		if (!here.value.length) {
			f.title.value=f.who.value=f.creator.value=f.tags.value='';
			f.cm.value=f.cd.value=f.cy.value=f.ch.value=f.cn.value='';
			f.mm.value=f.md.value=f.my.value=f.mh.value=f.mn.value='';
			return;
		}
		var tid=store.getTiddler(here.value); if (!tid) return;
		f.title.value=tid.title;
		f.who.value=tid.modifier;
		f.creator.value=tid.fields['creator']||''; // custom field - might not exist
		f.tags.value=tid.tags.map(function(t){return String.encodeTiddlyLink(t)}).join(' ');
		var c=tid.created; var m=tid.modified;
		f.cm.value=c.getMonth()+1;
		f.cd.value=c.getDate();
		f.cy.value=c.getFullYear();
		f.ch.value=c.getHours();
		f.cn.value=c.getMinutes();
		f.mm.value=m.getMonth()+1;
		f.md.value=m.getDate();
		f.my.value=m.getFullYear();
		f.mh.value=m.getHours();
		f.mn.value=m.getMinutes();
	},
	settiddlers: function(here) {
		var f=here.form; var list=f.list;
		var tids=[];
		for (i=0;i&lt;list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
		if (!tids.length) { alert('please select at least one tiddler'); return; }
		var cdate=new Date(f.cy.value,f.cm.value-1,f.cd.value,f.ch.value,f.cn.value);
		var mdate=new Date(f.my.value,f.mm.value-1,f.md.value,f.mh.value,f.mn.value);
		if (tids.length&gt;1 &amp;&amp; !confirm('Are you sure you want to update these tiddlers:\n\n'+tids.join(', '))) return;
		store.suspendNotifications();
		for (t=0;t&lt;tids.length;t++) {
			var tid=store.getTiddler(tids[t]); if (!tid) continue;
			var title=!f.settitle.checked?tid.title:f.title.value;
			var who=!f.setwho.checked?tid.modifier:f.who.value;
			var text=tid.text;
			if (f.replacetext.checked) {
				var r=f.replacement.value.replace(/\\t/mg,'\t').unescapeLineBreaks();
				text=text.replace(new RegExp(f.pattern.value,'mg'),r);
			}				
			var tags=tid.tags;
			if (f.settags.checked) { 
				var intags=f.tags.value.readBracketedList();
				var addtags=[]; var deltags=[]; var reptags=[];
				for (i=0;i&lt;intags.length;i++) {
					if (intags[i].substr(0,1)=='+')
						addtags.push(intags[i].substr(1));
					else if (intags[i].substr(0,1)=='-')
						deltags.push(intags[i].substr(1));
					else
						reptags.push(intags[i]);
				}
				if (reptags.length)
					tags=reptags;
				if (addtags.length)
					tags=new Array().concat(tags,addtags);
				if (deltags.length)
					for (i=0;i&lt;deltags.length;i++)
						{ var pos=tags.indexOf(deltags[i]); if (pos!=-1) tags.splice(pos,1); }
			}
			if (!f.setcdate.checked) cdate=tid.created;
			if (!f.setmdate.checked) mdate=tid.modified;
			store.saveTiddler(tid.title,title,text,who,mdate,tags,tid.fields);
			if (f.setcreator.checked) store.setValue(tid.title,'creator',f.creator.value); // set creator
			if (f.setcdate.checked) tid.assign(null,null,null,null,null,cdate); // set create date
		}
		store.resumeNotifications();
		this.init(f,f.sortby.value);
	},
	displaytiddlers: function(here,edit) {
		var f=here.form; var list=f.list;
		var tids=[];
		for (i=0; i&lt;list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
		if (!tids.length) { alert('please select at least one tiddler'); return; }
		story.displayTiddlers(story.findContainingTiddler(f),tids,edit?DEFAULT_EDIT_TEMPLATE:null);
	},
	deltiddlers: function(here) {
		var f=here.form; var list=f.list;
		var tids=[];
		for (i=0;i&lt;list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
		if (!tids.length) { alert('please select at least one tiddler'); return; }
		if (!confirm('Are you sure you want to delete these tiddlers:\n\n'+tids.join(', '))) return;
		store.suspendNotifications();
		for (t=0;t&lt;tids.length;t++) {
			var tid=store.getTiddler(tids[t]); if (!tid) continue;
			if (tid.tags.contains('systemConfig')) {
				var msg=tid.title+' is tagged with systemConfig.'
					+'\n\nRemoving this tiddler may cause unexpected results.  Are you sure?';
				if (!confirm(msg)) continue;
			}
			store.removeTiddler(tid.title);
			story.closeTiddler(tid.title);
		}
		store.resumeNotifications();
		this.init(f,f.sortby.value);
	},
	stats: function(here) {
		var f=here.form; var list=f.list; var tids=[]; var out=''; var tot=0;
		var target=f.nextSibling;
		for (i=0;i&lt;list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
		if (!tids.length) { alert('please select at least one tiddler'); return; }
		for (t=0;t&lt;tids.length;t++) {
			var tid=store.getTiddler(tids[t]); if (!tid) continue;
			out+='[['+tid.title+']] '+tid.text.length+'\n'; tot+=tid.text.length;
		}
		var avg=tot/tids.length;
		out=tot+' bytes in '+tids.length+' selected tiddlers ('+avg+' bytes/tiddler)\n&lt;&lt;&lt;\n'+out+'&lt;&lt;&lt;\n';
		removeChildren(target);
		target.innerHTML=&quot;&lt;hr&gt;&lt;font size=-2&gt;&lt;a href='javascript:;' style='float:right' &quot;
			+&quot;onclick='this.parentNode.parentNode.style.display=\&quot;none\&quot;'&gt;close&lt;/a&gt;&lt;/font&gt;&quot;;
		wikify(out,target);
		target.style.display='block';
	}
};
//}}}
/***
//{{{
!html
&lt;style&gt;
.tiddlerTweaker table,
.tiddlerTweaker table tr,
.tiddlerTweaker table td
	{ padding:0;margin:0;border:0;white-space:nowrap; }
&lt;/style&gt;&lt;form class='tiddlerTweaker'&gt;&lt;!--
--&gt;&lt;table style=&quot;width:100%&quot;&gt;&lt;tr valign=&quot;top&quot;&gt;&lt;!--
--&gt;&lt;td style=&quot;text-align:center;width:99%;&quot;&gt;&lt;!--
	--&gt;&lt;font size=-2&gt;&lt;div style=&quot;text-align:left;&quot;&gt;&lt;span style=&quot;float:right&quot;&gt;&lt;!--
	--&gt;&amp;nbsp; &lt;a href=&quot;javascript:;&quot; 
		title=&quot;select all tiddlers&quot;
		onclick=&quot;
		var f=this; while (f&amp;&amp;f.nodeName.toLowerCase()!='form')f=f.parentNode;
		for (var t=0; t&lt;f.list.options.length; t++)
			if (f.list.options[t].value.length) f.list.options[t].selected=true;
		config.macros.tiddlerTweaker.selecttiddlers(f.list);
		return false&quot;&gt;all&lt;/a&gt;&lt;!--
	--&gt;&amp;nbsp; &lt;a href=&quot;javascript:;&quot; 
		title=&quot;select tiddlers that are new/changed since the last file save&quot;
		onclick=&quot;
		var lastmod=new Date(document.lastModified);
		var f=this; while (f&amp;&amp;f.nodeName.toLowerCase()!='form')f=f.parentNode;
		for (var t=0; t&lt;f.list.options.length; t++) {
			var tid=store.getTiddler(f.list.options[t].value);
			f.list.options[t].selected=tid&amp;&amp;tid.modified&gt;lastmod;
		}
		config.macros.tiddlerTweaker.selecttiddlers(f.list);
		return false&quot;&gt;changed&lt;/a&gt;&lt;!--
	--&gt;&amp;nbsp; &lt;a href=&quot;javascript:;&quot; 
		title=&quot;select tiddlers with at least one matching tag&quot;
		onclick=&quot;
		var t=prompt('Enter space-separated tags (match ONE)');
		if (!t||!t.length) return false;
		var tags=t.readBracketedList();
		var f=this; while (f&amp;&amp;f.nodeName.toLowerCase()!='form')f=f.parentNode;
		for (var t=0; t&lt;f.list.options.length; t++) {
			f.list.options[t].selected=false;
			var tid=store.getTiddler(f.list.options[t].value);
			if (tid&amp;&amp;tid.tags.containsAny(tags)) f.list.options[t].selected=true;
		}
		config.macros.tiddlerTweaker.selecttiddlers(f.list);
		return false&quot;&gt;tags&lt;/a&gt;&lt;!--
	--&gt;&amp;nbsp; &lt;a href=&quot;javascript:;&quot; 
		title=&quot;select tiddlers whose titles include matching text&quot;
		onclick=&quot;
		var txt=prompt('Enter a title (or portion of a title) to match');
		if (!txt||!txt.length) return false;
		var f=this; while (f&amp;&amp;f.nodeName.toLowerCase()!='form')f=f.parentNode;
		for (var t=0; t&lt;f.list.options.length; t++) {
			f.list.options[t].selected=f.list.options[t].value.indexOf(txt)!=-1;
		}
		config.macros.tiddlerTweaker.selecttiddlers(f.list);
		return false&quot;&gt;titles&lt;/a&gt;&lt;!--
	--&gt;&amp;nbsp; &lt;a href=&quot;javascript:;&quot; 
		title=&quot;select tiddlers containing matching text&quot;
		onclick=&quot;
		var txt=prompt('Enter tiddler text (content) to match');
		if (!txt||!txt.length) return false;
		var f=this; while (f&amp;&amp;f.nodeName.toLowerCase()!='form')f=f.parentNode;
		for (var t=0; t&lt;f.list.options.length; t++) {
			var tt=store.getTiddlerText(f.list.options[t].value,'');
			f.list.options[t].selected=(tt.indexOf(txt)!=-1);
		}
		config.macros.tiddlerTweaker.selecttiddlers(f.list);
		return false&quot;&gt;text&lt;/a&gt; &amp;nbsp;&lt;!--
	--&gt;&lt;/span&gt;&lt;span&gt;select tiddlers&lt;/span&gt;&lt;!--
	--&gt;&lt;/div&gt;&lt;!--
	--&gt;&lt;/font&gt;&lt;select multiple name=list size=&quot;11&quot; style=&quot;width:99.99%&quot; 
		title=&quot;use click, shift-click and/or ctrl-click to select multiple tiddler titles&quot; 
		onclick=&quot;config.macros.tiddlerTweaker.selecttiddlers(this)&quot; 
		onchange=&quot;config.macros.tiddlerTweaker.setfields(this)&quot;&gt;&lt;!--
	--&gt;&lt;/select&gt;&lt;br&gt;&lt;!--
	--&gt;show&lt;input type=text size=1 value=&quot;11&quot; 
		onchange=&quot;this.form.list.size=this.value; this.form.list.multiple=(this.value&gt;1);&quot;&gt;&lt;!--
	--&gt;by&lt;!--
	--&gt;&lt;select name=sortby size=1 
		onchange=&quot;config.macros.tiddlerTweaker.init(this.form,this.value)&quot;&gt;&lt;!--
	--&gt;&lt;option value=&quot;title&quot;&gt;title&lt;/option&gt;&lt;!--
	--&gt;&lt;option value=&quot;size&quot;&gt;size&lt;/option&gt;&lt;!--
	--&gt;&lt;option value=&quot;modified&quot;&gt;modified&lt;/option&gt;&lt;!--
	--&gt;&lt;option value=&quot;created&quot;&gt;created&lt;/option&gt;&lt;!--
	--&gt;&lt;option value=&quot;modifier&quot;&gt;modifier&lt;/option&gt;&lt;!--
	--&gt;&lt;/select&gt;&lt;!--
	--&gt;&lt;input type=&quot;button&quot; value=&quot;refresh&quot; 
		onclick=&quot;config.macros.tiddlerTweaker.init(this.form,this.form.sortby.value)&quot;&lt;!--
	--&gt; &lt;input type=&quot;button&quot; name=&quot;stats&quot; disabled value=&quot;totals...&quot; 
		onclick=&quot;config.macros.tiddlerTweaker.stats(this)&quot;&gt;&lt;!--
--&gt;&lt;/td&gt;&lt;td style=&quot;width:1%&quot;&gt;&lt;!--
	--&gt;&lt;div style=&quot;text-align:left&quot;&gt;&lt;font size=-2&gt;&amp;nbsp;modify values&lt;/font&gt;&lt;/div&gt;&lt;!--
	--&gt;&lt;table style=&quot;width:100%;&quot;&gt;&lt;tr&gt;&lt;!--
	--&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=checkbox name=settitle unchecked 
			title=&quot;allow changes to tiddler title (rename tiddler)&quot; 
			onclick=&quot;this.form.title.disabled=!this.checked&quot;&gt;title&lt;!--
	--&gt;&lt;/td&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=text name=title size=35 style=&quot;width:98%&quot; disabled&gt;&lt;!--
	--&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=checkbox name=setcreator unchecked 
			title=&quot;allow changes to tiddler creator&quot; 
			onclick=&quot;this.form.creator.disabled=!this.checked&quot;&gt;created by&lt;!--
	--&gt;&lt;/td&gt;&lt;td style=&quot;padding:1px;&quot;&gt;&lt;!--
		--&gt;&lt;input type=text name=creator size=35 style=&quot;width:98%&quot; disabled&gt;&lt;!--
	--&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=checkbox name=setwho unchecked 
			title=&quot;allow changes to tiddler author&quot; 
			onclick=&quot;this.form.who.disabled=!this.checked&quot;&gt;modified by&lt;!--
	--&gt;&lt;/td&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=text name=who size=35 style=&quot;width:98%&quot; disabled&gt;&lt;!--
	--&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=checkbox name=setcdate unchecked 
			title=&quot;allow changes to created date&quot; 
			onclick=&quot;var f=this.form;
				f.cm.disabled=f.cd.disabled=f.cy.disabled=f.ch.disabled=f.cn.disabled=!this.checked&quot;&gt;&lt;!--
		--&gt;created on&lt;!--
	--&gt;&lt;/td&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=text name=cm size=2 style=&quot;width:2em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
		--&gt; / &lt;input type=text name=cd size=2 style=&quot;width:2em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
		--&gt; / &lt;input type=text name=cy size=4 style=&quot;width:3em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
		--&gt; at &lt;input type=text name=ch size=2 style=&quot;width:2em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
		--&gt; : &lt;input type=text name=cn size=2 style=&quot;width:2em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
	--&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=checkbox name=setmdate unchecked 
			title=&quot;allow changes to modified date&quot; 
			onclick=&quot;var f=this.form;
				f.mm.disabled=f.md.disabled=f.my.disabled=f.mh.disabled=f.mn.disabled=!this.checked&quot;&gt;&lt;!--
		--&gt;modified on&lt;!--
	--&gt;&lt;/td&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=text name=mm size=2 style=&quot;width:2em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
		--&gt; / &lt;input type=text name=md size=2 style=&quot;width:2em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
		--&gt; / &lt;input type=text name=my size=4 style=&quot;width:3em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
		--&gt; at &lt;input type=text name=mh size=2 style=&quot;width:2em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
		--&gt; : &lt;input type=text name=mn size=2 style=&quot;width:2em;padding:0;text-align:center&quot; disabled&gt;&lt;!--
	--&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=checkbox name=replacetext unchecked
			title=&quot;find/replace matching text&quot; 
			onclick=&quot;this.form.pattern.disabled=this.form.replacement.disabled=!this.checked&quot;&gt;replace text&lt;!--
	--&gt;&lt;/td&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=text name=pattern size=15 value=&quot;&quot; style=&quot;width:40%&quot; disabled 
			title=&quot;enter TEXT PATTERN (regular expression)&quot;&gt; with&lt;!--
		--&gt;&lt;input type=text name=replacement size=15 value=&quot;&quot; style=&quot;width:40%&quot; disabled 
			title=&quot;enter REPLACEMENT TEXT&quot;&gt;&lt;!--
	--&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=checkbox name=settags checked 
			title=&quot;allow changes to tiddler tags&quot; 
			onclick=&quot;this.form.tags.disabled=!this.checked&quot;&gt;tags&lt;!--
	--&gt;&lt;/td&gt;&lt;td style=&quot;padding:1px&quot;&gt;&lt;!--
		--&gt;&lt;input type=text name=tags size=35 value=&quot;&quot; style=&quot;width:98%&quot; 
			title=&quot;enter new tags or use '+tag' and '-tag' to add/remove tags from existing tags&quot;&gt;&lt;!--
	--&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;!--
	--&gt;&lt;div style=&quot;text-align:center&quot;&gt;&lt;!--
	--&gt;&lt;nobr&gt;&lt;input type=button name=display disabled style=&quot;width:24%&quot; value=&quot;display&quot; 
		title=&quot;show selected tiddlers&quot;
		onclick=&quot;config.macros.tiddlerTweaker.displaytiddlers(this,false)&quot;&gt;&lt;!--
	--&gt; &lt;input type=button name=edit disabled style=&quot;width:23%&quot; value=&quot;edit&quot; 
		title=&quot;edit selected tiddlers&quot;
		onclick=&quot;config.macros.tiddlerTweaker.displaytiddlers(this,true)&quot;&gt;&lt;!--
	--&gt; &lt;input type=button name=del disabled style=&quot;width:24%&quot; value=&quot;delete&quot; 
		title=&quot;remove selected tiddlers&quot;
		onclick=&quot;config.macros.tiddlerTweaker.deltiddlers(this)&quot;&gt;&lt;!--
	--&gt; &lt;input type=button name=set disabled style=&quot;width:24%&quot; value=&quot;update&quot; 
		title=&quot;update selected tiddlers&quot;
		onclick=&quot;config.macros.tiddlerTweaker.settiddlers(this)&quot;&gt;&lt;/nobr&gt;&lt;!--
	--&gt;&lt;/div&gt;&lt;!--
--&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;!--
--&gt;&lt;/form&gt;&lt;span style=&quot;display:none&quot;&gt;&lt;!--content replaced by tiddler &quot;stats&quot;--&gt;&lt;/span&gt;
!end
//}}}
***/</pre>
</div>
<div title="TiddlyLockPlugin" modifier="dger" created="200705101358" modified="201009301852" tags="systemConfig plugin %tw-elnb">
<pre>/***
|Name|TiddlyLockPlugin|
|Source|http://www.minormania.com/tiddlylock/tiddlylock.html|
|Version|1.2|
|Author|Richard Hobbis|
|License|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|Type|plugin|
|Overrides|config.macros.newTiddler.onClickNewTiddler()&lt;br&gt;config.commands.cancelTiddler.handler()&lt;br&gt;config.commands.deleteTiddler.handler&lt;br&gt;config.commands.editTiddler.handler()&lt;br&gt;config.commands.saveTiddler.handler()&lt;br&gt;saveChanges()&lt;br&gt;checkUnsavedChanges()|
|Description|Automatically locks and unlocks the TiddlyWiki as required, allowing multiple users to edit the TiddlyWiki without fear of overwriting other users' changes.|
!!!Usage
&lt;&lt;&lt;
Simply import TiddlyLockPlugin into your TiddlyWiki!
&lt;&lt;&lt;
!!!Installation
&lt;&lt;&lt;
Import (or copy/paste) ''this tiddler'' into your TiddlyWiki and make sure it's tagged with &lt;&lt;tag systemConfig&gt;&gt;. Reload your TiddlyWiki to enable TiddlyLock.
&lt;&lt;&lt;
!!!Configuration
&lt;&lt;&lt;
None required!
&lt;&lt;&lt;
!!!Revision History
&lt;&lt;&lt;
''2010.07.06 [1.2.0]'' Allow the location of the Lock File to be specified by the user, instead of defaulting to the location of the TiddlyWiki file. The default location is the same folder as the TiddlyWiki file itself, however this can be changed by editing ''//this html file//'' in a text editor and search for {{{TiddlyLock.LockPath = '';}}} The folder will be created if it doesn't exist.
''2010.07.06 [1.2.0]'' Upgraded this TiddlyWiki to core version 2.6
''2008.05.15 [1.1.0]'' Upgraded source TiddlyWiki to use core version 2.4. Tested and verified TiddlyLock under version 2.4.
''2007.06.22 [1.0.4]'' Added locking on 'new tiddler' which also traps 'new journal'. Tweaked messages.
''2007.06.20 [1.0.3]'' Fixed an issue that occurred when a user navigated away from the TiddlyWiki without saving outstanding changes.
''2007.05.10 [1.0.2]'' Implemented a timestamp to track the last update time. This fixes the multi-browser edit issue and also removes the need for a password.
''2007.05.08 [1.0.1]'' Function overrides are now done using apply() ensuring clean upgrades (thanks Martin!)
''2007.05.01 [1.0.0]'' Initial Release
&lt;&lt;&lt;
!!!Known Issues
&lt;&lt;&lt;
*Monkey Pirate TiddlyWiki (MPTW) adds a ''disable'' button to the toolbar for systemConfig tiddlers. This button is available even when the TW is marked as readOnly and therefore it's possible for two users to disable/enable plugins at the same time. In this case, whoever saves the TW last will 'win' and their changes will be saved. Note that this is only an issue if there are no other unsaved changes in both browsers - TiddlyLock still handles all other changes.
&lt;&lt;&lt;
!!!Credits
&lt;&lt;&lt;
This feature was developed by Richard Hobbis (rhobbis [at] hotmail [dot] com).
&lt;&lt;&lt;
!!!Code
***/

//{{{
// Convert a date to UTC YYYYMMDDHHMMSSMMM string format
// This is the same as the builtin function convertToYYYYMMDDHHMMSSMMM() but
// without the '.' in the middle - this allows simple date comparisons
Date.prototype.TLConvertToYYYYMMDDHHMMSSMMM = function()
{
  return(String.zeroPad(this.getUTCFullYear(),4)
    + String.zeroPad(this.getUTCMonth()+1,2)
    + String.zeroPad(this.getUTCDate(),2)
    + String.zeroPad(this.getUTCHours(),2)
    + String.zeroPad(this.getUTCMinutes(),2)
    + String.zeroPad(this.getUTCSeconds(),2)
    + String.zeroPad(this.getUTCMilliseconds(),4));
}

// namespace for TiddlyLock
TiddlyLock = {};

// Load/Last Update timestamp
TiddlyLock.TimeStamp = new Date().TLConvertToYYYYMMDDHHMMSSMMM();

// Lockfile
TiddlyLock.LockPath = ''; // custom values *must* include trailing '\\'
TiddlyLock.OldLockData = '';
TiddlyLock.LockData = '';
TiddlyLock.LockFile = TLLockPath();
// define messages
TiddlyLock.Msg = {
  Locked: 'File locked',
  Unlocked: 'File unlocked',
  LockFailed: 'Failed to lock file',
  UnlockFailed: 'Failed to unlock file',
  ReadOnly: 'Now in Read-Only mode.',
  Changed: 'This file has been changed by someone else.',
  Reload: 'Reload this file before editing.'};

// create/update the lock file
function TLSave(timeStamp,lockedBy)
{
  var lockedText='';
  if (lockedBy!='')
  {
    lockedText=timeStamp+'##'+lockedBy;
  }
  else lockedText=timeStamp+'##';
    var lockSave=saveFile(TiddlyLock.LockFile,lockedText);
  TiddlyLock.TimeStamp = timeStamp;
  return false;
}


// Create/update the lock file to prevent other users from editing the TW
function TLLock()
{
  clearMessage();
  lockSave = TLSave(new Date().TLConvertToYYYYMMDDHHMMSSMMM(),config.options.txtUserName);
  displayMessage(TiddlyLock.Msg.Locked,'');
  return false;
}


// Clear the lock file if necessary, but only if I have it locked, setting the
// timestamp in the lockfile to the specified value
function TLUnlock(timeStamp)
{
  if ((store &amp;&amp; store.isDirty &amp;&amp; !store.isDirty())
    &amp;&amp; (story &amp;&amp; story.areAnyDirty &amp;&amp; !story.areAnyDirty())
    &amp;&amp; TLIsLocked()
    &amp;&amp; TLIsLockedByMe())
  {
    lockSave=TLSave(timeStamp,'','');
    displayMessage(TiddlyLock.Msg.Unlocked,'');
    TiddlyLock.OldLockData = TiddlyLock.LockData;
  }
  return false;
}

// Get the contents of the lock file, if it exists
function TLLockPath()
{
  var lockPath,pathRoot,p,fileName;
  var fullPath=document.location.toString();
  if(TiddlyLock.LockPath!='') pathRoot=TiddlyLock.LockPath; // location of lock file is defined by TiddlyLock.LockPath
  else pathRoot=getLocalPath(fullPath); // location of lock file is derived from the wiki filename
  if((p=pathRoot.lastIndexOf('\\'))!=-1) pathRoot=pathRoot.substr(0,p+1); // truncate any trailing filename (derived paths only)
  fileName=getLocalPath(fullPath); // full wiki file name, including path
  if((p=fileName.lastIndexOf('\\'))!=-1) fileName=fileName.substr(p+1); // truncate everything up to the last slash
  if((p=fileName.lastIndexOf('.'))!=-1) fileName=fileName.substr(0,p); // remove any existing extension
  fileName=fileName+'.lck'; // add new extension
  return pathRoot+fileName;
}

// Get the contents of the lock file, if it exists
function TLLockData()
{
  return loadFile(TiddlyLock.LockFile);
}

// Get the contents of the lock file, if it exists
function TLIsLocked()
{
  TiddlyLock.LockData = TLLockData();
  if (TiddlyLock.LockData
      &amp;&amp; ( TLLockedBy(TiddlyLock.LockData)!='' // someone has it locked
         || TiddlyLock.TimeStamp &lt; TLLockedTimeStamp(TiddlyLock.LockData) // changed by someone else but not currently locked
         )
     )
    return true;
  else
    return false;
}


// check if locked by me
function TLIsLockedByMe()
{
  if(TiddlyLock.LockData == TiddlyLock.TimeStamp+'##' + config.options.txtUserName)
    return true;
  else
    return false;
}


// returns just the timestamp portion of the supplied lock file contents
function TLLockedTimeStamp(lockData)
{
  if(lockData)
    return lockData.split('##')[0];
  else
    return '';
}


// returns just the username portion of the supplied lock file contents
function TLLockedBy(lockData)
{
  if(lockData)
    return lockData.split('##')[1];
  else
    return '';
}

// display a message if locked or changed
function TLChangesAllowed()
{
  if(TLIsLocked() &amp;&amp; !TLIsLockedByMe())
  {
    readOnly=true;
    if(TLLockedBy(TiddlyLock.LockData))
    {
      displayMessage(TiddlyLock.Msg.Locked+' by '+TLLockedBy(TiddlyLock.LockData));
      alert(TiddlyLock.Msg.Locked+' by '+TLLockedBy(TiddlyLock.LockData)+'. '+TiddlyLock.Msg.ReadOnly);
    }
    else
    {
      displayMessage(TiddlyLock.Msg.Changed+' '+TiddlyLock.Msg.Reload);
      alert(TiddlyLock.Msg.Changed+' '+TiddlyLock.Msg.Reload);
    }
    return false;
  }
  else
    return true;
}


//*********************************************
// OVERRIDE STANDARD FUNCTIONS
//*********************************************

//
// OVERRIDE onClickNewTiddler()
//
TiddlyLock.onClickNewTiddler = config.macros.newTiddler.onClickNewTiddler;
config.macros.newTiddler.onClickNewTiddler = function(event,src,title)
{
  if (TLChangesAllowed())
  {
    TiddlyLock.OldLockData = TiddlyLock.LockData;
    TLLock();
    var ret = TiddlyLock.onClickNewTiddler.apply(this,arguments);
    return ret;
  }
}

//
// OVERRIDE checkUnsavedChanges()
//
TiddlyLock.checkUnsavedChanges = checkUnsavedChanges;
checkUnsavedChanges = function(event,src,title)
{
  var ret = TiddlyLock.checkUnsavedChanges.apply(this,arguments);
  if(TLIsLocked() &amp;&amp; TLIsLockedByMe())
    lockSave=TLSave(TLLockedTimeStamp(TiddlyLock.OldLockData),'','');
  return ret;
}


//
// OVERRIDE cancelTiddler()
//
TiddlyLock.cancelTiddler = config.commands.cancelTiddler.handler;
config.commands.cancelTiddler.handler = function(event,src,title)
{
  var ret = TiddlyLock.cancelTiddler.apply(this,arguments);
  TLUnlock(TLLockedTimeStamp(TiddlyLock.OldLockData));
  return ret;
}

//
// OVERRIDE deleteTiddler()
//
TiddlyLock.deleteTiddler = config.commands.deleteTiddler.handler;
config.commands.deleteTiddler.handler = function(event,src,title)
{
  if (TLChangesAllowed())
  {
    TiddlyLock.OldLockData = TiddlyLock.LockData;
    TLLock();
    var ret = TiddlyLock.deleteTiddler.apply(this,arguments);
    return ret;
  }
}

//
// OVERRIDE editTiddler()
//
TiddlyLock.editTiddler = config.commands.editTiddler.handler;
config.commands.editTiddler.handler = function(event,src,title)
{
  if (TLChangesAllowed())
  {
    TiddlyLock.OldLockData = TiddlyLock.LockData;
    TLLock();
  }
  var ret = TiddlyLock.editTiddler.apply(this,arguments);
  return ret;
}

//
// OVERRIDE saveChanges()
//
TiddlyLock.saveChanges = saveChanges;
saveChanges = function(onlyIfDirty)
{
  if(TLChangesAllowed())
  {
    var ret = TiddlyLock.saveChanges.apply(this,arguments);
    TLUnlock(new Date().TLConvertToYYYYMMDDHHMMSSMMM());
    return ret;
  }
  else
    return false;
}

//
// OVERRIDE saveTiddler()
//
TiddlyLock.saveTiddler= config.commands.saveTiddler.handler;
config.commands.saveTiddler.handler=function(event,src,title)
{
  var ret = TiddlyLock.saveTiddler.apply(this,arguments);
  TLUnlock(new Date().TLConvertToYYYYMMDDHHMMSSMMM());
  return ret;
}

//}}}</pre>
</div>
<div title="ToggleTagPlugin" modifier="dger" created="201007191657" modified="201009301850" tags="systemConfig plugin pluginInfo %tw-elnb">
<pre>/***
|Name:|ToggleTagPlugin|
|Description:|Makes a checkbox which toggles a tag in a tiddler|
|Version:|3.1.0 ($Rev: 4907 $)|
|Date:|$Date: 2008-05-13 03:15:46 +1000 (Tue, 13 May 2008) $|
|Source:|http://mptw.tiddlyspot.com/#ToggleTagPlugin|
|Author:|Simon Baird &lt;simon.baird@gmail.com&gt;|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Usage
{{{&lt;&lt;toggleTag }}}//{{{TagName TiddlerName LabelText}}}//{{{&gt;&gt;}}}
* TagName - the tag to be toggled, default value &quot;checked&quot;
* TiddlerName - the tiddler to toggle the tag in, default value the current tiddler
* LabelText - the text (gets wikified) to put next to the check box, default value is '{{{[[TagName]]}}}' or '{{{[[TagName]] [[TiddlerName]]}}}'
(If a parameter is '.' then the default will be used)
* TouchMod flag - if non empty then touch the tiddlers mod date. Note, can set config.toggleTagAlwaysTouchModDate to always touch mod date
!!Examples
|Code|Description|Example|h
|{{{&lt;&lt;toggleTag&gt;&gt;}}}|Toggles the default tag (checked) in this tiddler|&lt;&lt;toggleTag&gt;&gt;|
|{{{&lt;&lt;toggleTag TagName&gt;&gt;}}}|Toggles the TagName tag in this tiddler|&lt;&lt;toggleTag TagName&gt;&gt;|
|{{{&lt;&lt;toggleTag TagName TiddlerName&gt;&gt;}}}|Toggles the TagName tag in the TiddlerName tiddler|&lt;&lt;toggleTag TagName TiddlerName&gt;&gt;|
|{{{&lt;&lt;toggleTag TagName TiddlerName 'click me'&gt;&gt;}}}|Same but with custom label|&lt;&lt;toggleTag TagName TiddlerName 'click me'&gt;&gt;|
|{{{&lt;&lt;toggleTag . . 'click me'&gt;&gt;}}}|dot means use default value|&lt;&lt;toggleTag . . 'click me'&gt;&gt;|
!!Notes
* If TiddlerName doesn't exist it will be silently created
* Set label to '-' to specify no label
* See also http://mgtd-alpha.tiddlyspot.com/#ToggleTag2
!!Known issues
* Doesn't smoothly handle the case where you toggle a tag in a tiddler that is current open for editing
* Should convert to use named params
***/
//{{{

if (config.toggleTagAlwaysTouchModDate == undefined) config.toggleTagAlwaysTouchModDate = false;

merge(config.macros,{

	toggleTag: {

		createIfRequired: true,
		shortLabel: &quot;[[%0]]&quot;,
		longLabel: &quot;[[%0]] [[%1]]&quot;,

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {
			var tiddlerTitle = tiddler ? tiddler.title : '';
			var tag   = (params[0] &amp;&amp; params[0] != '.') ? params[0] : &quot;checked&quot;;
			var title = (params[1] &amp;&amp; params[1] != '.') ? params[1] : tiddlerTitle;
			var defaultLabel = (title == tiddlerTitle ? this.shortLabel : this.longLabel);
			var label = (params[2] &amp;&amp; params[2] != '.') ? params[2] : defaultLabel;
			var touchMod = (params[3] &amp;&amp; params[3] != '.') ? params[3] : &quot;&quot;;
			label = (label == '-' ? '' : label); // dash means no label
			var theTiddler = (title == tiddlerTitle ? tiddler : store.getTiddler(title));
			var cb = createTiddlyCheckbox(place, label.format([tag,title]), theTiddler &amp;&amp; theTiddler.isTagged(tag), function(e) {
				if (!store.tiddlerExists(title)) {
					if (config.macros.toggleTag.createIfRequired) {
						var content = store.getTiddlerText(title); // just in case it's a shadow
						store.saveTiddler(title,title,content?content:&quot;&quot;,config.options.txtUserName,new Date(),null);
					}
					else 
						return false;
				}
				if ((touchMod != &quot;&quot; || config.toggleTagAlwaysTouchModDate) &amp;&amp; theTiddler)
						theTiddler.modified = new Date();
				store.setTiddlerTag(title,this.checked,tag);
				return true;
			});
		}
	}
});

//}}}</pre>
</div>
<div title="TrashPlugin" modifier="dger" created="201007171445" modified="201009240930" tags="systemConfig plugin pluginInfo %tw-elnb TrashExtension">
<pre>/***
|Name:|TrashPlugin|
|Version:|1.2.0|
|Source:|http://www.TiddlyTools.com/#TrashPlugin|
|Author:|Eric Shulman|
|OriginalSource:|http://ido-xp.tiddlyspot.com/#TrashPlugin|
|OriginalAuthor:|Ido Magal (idoXatXidomagalXdotXcom)|
|License:|[[BSD open source license]]|
|CoreVersion:|2.1.0|
|Description|add 'Trash' tag to tiddlers instead of deleting them|
!!!!!Documentation
&lt;&lt;&lt;
When TrashPlugin is installed and you click on the 'delete' command in the tiddler toolbar, rather than directly removing the tiddler from the system, it will be tagged with the following tags:
{{{
Trash excludeLists excludeMissing excludeSearch systemConfigDisable
}}}
As a result, although the tiddler still exists within the document, it is ''hidden from view and will not be searched or invoked as a plugin.''
*{{block{
To view a list of all tiddlers tagged with {{{Trash}}}, simply open the [[Trash]] tiddler (aka, the &quot;trash can&quot;).}}}
*{{block{
To reclaim a tiddler from the [[Trash]], click on a title in the trash can to open that tiddler.  Then, edit it to remove the Trash tag (as well as the other tags noted above).}}}
*{{block{
To empty the trash can (i.e. actually //delete// the tiddlers), click on the ''//&quot;empty trash&quot;//'' button that appears in the [[Trash]] tiddler.  You can also add this button to your [[SideBarOptions]] or any other desired location by using the following macro:
{{{
&lt;&lt;emptyTrash&gt;&gt;
}}}
}}}
*{{block{
To ''bypass the trash can'' and use the normal delete handling (with the usual confirmation messages, if chkConfirmDelete is enabled), hold CTRL while clicking 'delete'}}}
*{{block{
To ''bypass both the trash can //and// the confirmation message'' and //immediately delete// the tiddler without any further interaction, hold CTRL+SHIFT while clicking 'delete'}}}
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.05.20 [1.2.0] documentation rewrite and code cleanup/reduction
2009.05.12 [1.1.0.5] refactored code to add entry point: {{{config.commands.deleteTiddler.sendToTrash(title)}}}
2008.11.14 [1.1.0.4] added SHIFT-CLICK = bypass trash and delete immediately WITHOUT CONFIRMATION
2008.10.14 [1.1.0.3] return FALSE from emptyTrash() handler (fixes IE page transition error)
2008.05.18 [1.1.0.2] when creating the Trash tiddler, pass an empty tags array [] instead of a null value, so other plugins (e.g., InstantTimestampPlugin) won't fail
2006.12.21 [1.1.0.1] only call setDirty() when actually removing tiddlers from trash
2006.12.12 [1.1.0.0] added movedMsg (feedback when tiddler is tagged as Trash).   Make sure tiddler actually exists before tagging it with 'Trash'.  Fetch correct tiddler before checking for 'systemConfig' tag
2006.12.11 [1.0.3.1] Don't create Trash tiddler until needed. Remove Trash tiddler when no trash remains. Don't tag Trash tiddler with 'TrashPlugin'. Moved all user-visible strings to variables so they can be translated by 'lingo' plugins. Use displayMessage() instead of alert()
2006.12.11 [1.0.3] Fixed broken reference to core deleteTiddler. Now storing reference to core deleteTiddler in emptyTrash macro. Reduced deleteTiddler hijacking to only the handler.
2006.12.11 [1.0.2] EmptyTrash now uses removeTiddler instead of deleteTiddler. Supports trashing systemConfig tiddlers (adds systemConfigDisable tag).
2006.12.10 [1.0.1] Replaced TW version with proper Core reference. Now properly hijacking deleteTiddler command.
2006.12.10 [1.0.0] First draft.
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.TrashPlugin= {major: 1, minor: 2, revision: 0, date: new Date(2009,5,20)};
//}}}
//{{{
config.macros.emptyTrash = {
	tag: 'Trash',
	movedMsg: &quot;'%0' has been tagged as %1&quot;,
	label: 'empty trash',
	tooltip: 'Delete all items tagged as %0',
	tooltipOlder: 'Delete items tagged as %0 that are older than %1 days old',
	emptyMsg: 'The trash is empty',
	noneToDeleteMsg: 'There are no items in the trash older than %0 days',
	confirmMsg: &quot;The following tiddlers will be deleted:\n\n'%0'\n\nOK to proceed?&quot;,
	deletedMsg: &quot;Deleted '%0'&quot;,
	handler: function ( place,macroName,params,wikifier,paramString,tiddler ) {
		var namedParams = (paramString.parseParams(daysOld))[0];
		var daysOld = namedParams['daysOld'] ? namedParams['daysOld'][0] : 0; // default
		var buttonTitle = namedParams['title'] ? namedParams['title'][0] : this.label;
		var buttonTip=this.tooltip.format([this.tag])
		if (daysOld) buttonTip=this.tooltipOlder.format([this.tag,daysOld])
		var b=createTiddlyButton(place,buttonTitle,buttonTip,this.emptyTrash);
		b.setAttribute('daysOld',daysOld);
	},
	emptyTrash: function() {
		var cme=config.macros.emptyTrash; // abbrev
		var daysOld=this.getAttribute('daysOld');
		var compareDate=new Date(); compareDate.setDate(compareDate.getDate()-daysOld);
		var collected=[];
		store.forEachTiddler(function(title,tiddler) {
			if (tiddler.isTagged(cme.tag) &amp;&amp; tiddler.modified&lt;compareDate)
				collected.push(title);
		});
		if (!collected.length)
			displayMessage(daysOld ? cme.noneToDeleteMsg.format([daysOld]) : cme.emptyMsg);
		else if (confirm(cme.confirmMsg.format([collected.join(&quot;', '&quot;)]))) {
			for (var i=0;i&lt;collected.length;i++) {
				store.removeTiddler(collected[i]);
				store.setDirty(true);
				displayMessage(cme.deletedMsg.format([collected[i]]));
			}
		}
		if (!store.getTaggedTiddlers(cme.tag).length) // remove Trash if empty
			{ story.closeTiddler(cme.tag,true,false); store.removeTiddler(cme.tag); }
		else
			story.refreshTiddler(cme.tag,false,true); // refresh Trash if visible
		return false;
	}
}
//}}}
// // hijack delete command
//{{{
config.commands.deleteTiddler.orig_handler=config.commands.deleteTiddler.handler;
config.commands.deleteTiddler.handler=function(event,src,title) {
	// BYPASS TRASH: CTRL=normal delete, CTRL+SHIFT=without confirmation
	if (event.ctrlKey) {
		if (event.shiftKey) { var temp=config.options.chkConfirmDelete; config.options.chkConfirmDelete=false; }
		config.commands.deleteTiddler.orig_handler.apply(this,arguments);
		if (event.shiftKey) config.options.chkConfirmDelete=temp;
		story.refreshTiddler(config.macros.emptyTrash.tag,false,true);
		return false;
	}
	config.commands.deleteTiddler.sendToTrash(title);
	return false;
};

config.commands.deleteTiddler.sendToTrash = function(title) {
	var cme=config.macros.emptyTrash; // abbrev
	if (!store.tiddlerExists(title)) return; // make sure tiddler actually exists
	if (!store.tiddlerExists(cme.tag)) // make sure Trash tiddler exists
		store.saveTiddler(cme.tag,cme.tag,'&lt;&lt;emptyTrash&gt;&gt;','TrashPlugin',new Date(),[],{});
	store.setTiddlerTag(title,1,cme.tag);
	store.setTiddlerTag(title,1,'excludeLists');
	store.setTiddlerTag(title,1,'excludeMissing');
	store.setTiddlerTag(title,1,'excludeSearch');
	if (store.getTiddler(title).isTagged('systemConfig'))
		store.setTiddlerTag(title,1,'systemConfigDisable');
	story.closeTiddler(title,true);
	if(config.options.chkAutoSave) saveChanges();
	displayMessage(cme.movedMsg.format([title,cme.tag]));
	story.refreshTiddler(cme.tag,false,true);
};
//}}}</pre>
</div>
<div title="UnsavedChangesPlugin" modifier="dger" created="201010031039" modified="201010181624" tags="plugin pluginInfo systemConfig %tw-elnb">
<pre>/***
|Name|UnsavedChangesPlugin|
|Source|http://www.TiddlyTools.com/#UnsavedChangesPlugin|
|Version|3.3.3|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|show droplist of tiddlers that have changed since the last time the document was saved|
Display a list of tiddlers that have been changed since the last time the document was saved.  The list includes all new/modified tiddlers as well as those changed with &quot;minor edits&quot; enabled and any tiddlers that you import during the session, regardless of their modification date.
!!!!!Usage
&lt;&lt;&lt;
{{{
&lt;&lt;unsavedChanges panel&gt;&gt; or &lt;&lt;unsavedChanges&gt;&gt;
}}}
{{indent{
the ''panel'' keyword displays a 'control panel' interface containing a droplist of unsaved tiddlers and a 'goto' button, along with a command link to 'save changes'.  Depending upon what other plugins are installed, several additional elements will also be displayed: When [[NestedSlidersPlugin]] is installed, the entire control panel is contained within a ''SLIDER''.  When [[LoadTiddlersPlugin]] is installed, a ''REVERT'' button is added.  When [[SaveAsPlugin]] is installed, a ''SAVE AS'' link is added.  When [[UploadPlugin]] is installed, an ''UPLOAD'' (or ''save to web'') link is added.  When [[TrashPlugin]] is installed and there are tiddlers tagged with&lt;&lt;tag Trash&gt;&gt;, an ''EMPTY TRASH'' link is added.
}}}
{{{
&lt;&lt;unsavedChanges list separator&gt;&gt;
}}}
{{indent{
the ''list'' keyword displays a simple space-separated list of unsaved tiddlers without any other command links.  You can specify an optional ''separator'' value that can be used in place of the default space character.  For example, you can specify {{{&quot;&lt;br&gt;&quot;}}} as the separator in order to display each link, one per line.
}}}
{{{
&lt;&lt;unsavedChanges command label tip&gt;&gt;
}}}
{{indent{
the ''command'' keyword displays a single 'command link' that, when clicked, displays a ~TiddlyWiki popup containing the list of unsaved tiddlers, the 'save changes' command and, depending upon what other plugins are installed, additional commands for 'save as', 'upload', and 'empty trash' (similar to the panel display described above).

You can specify optional ''label'' and ''tip'' parameters in the macro to customize the command link text and tooltip.  The default label for the command link is: &quot;There %1 %0 unsaved tiddler%2...&quot;, where:
* %0 is automatically replaced with the number of unsaved changes
* %1 is either &quot;is&quot; (if changes=1) or &quot;are&quot; (if changes&gt;1)
* %2 is either blank (if changes=1) or &quot;s&quot; (if changes&gt;1)
resulting in the text: //&quot;There is 1 unsaved tiddler...&quot;, &quot;There are 2 unsaved tiddlers...&quot;, etc.//
}}}
&lt;&lt;&lt;
!!!!!Examples
&lt;&lt;&lt;
^^//note: the following examples will not display any output unless you have already created/modified tiddlers in the current document.//^^
{{{&lt;&lt;unsavedChanges&gt;&gt;}}}
&lt;&lt;unsavedChanges&gt;&gt;
----
{{{&lt;&lt;unsavedChanges command&gt;&gt;}}}
&lt;&lt;unsavedChanges command&gt;&gt;
----
{{{&lt;&lt;unsavedChanges list&gt;&gt;}}}
&lt;&lt;unsavedChanges list&gt;&gt;
----
{{{&lt;&lt;unsavedChanges list &quot;&lt;br&gt;&quot;&gt;&gt;}}}
&lt;&lt;unsavedChanges list &quot;&lt;br&gt;&quot;&gt;&gt;
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.03.02 [3.3.3] fix handling for titles that contain HTML special chars (lt,gt,quot,amp)
2008.09.02 [3.3.2] cleanup popup list output generation and added timestamps/sizes to popup display
2008.08.23 [3.3.1] added optional custom 'label' and 'tip' params to 'command' mode and defined default values for mode, label, tip, and separator as object properties for I18N/L10N-readiness.
2008.08.21 [3.3.0] complete re-write of rendering and refresh processing to support multiple instances and automatic self-refresh (no longer depends upon core refresh notifications)
2008.08.21 [3.2.0] added 'command' option for link+popup as alternative to 'control panel' interface
2008.04.22 [3.1.2] use SaveAsPlugin instead of obsolete NewDocumentPlugin to add &quot;save as&quot; link
2007.12.22 [3.1.1] hijack removeTiddler() instead of low-level deleteTiddler() to correct tracking and refresh handling issues.  in saveTiddler(), check for 'tiddler rename' (title!=newtitle) and adjust list accordingly.
2007.12.21 [3.1.0] added support for {{{&lt;&lt;unsavedChanges list separator&gt;&gt;}}} usage to unsaved tiddlers as a simple list of links, embedded in tiddler content (e.g., [[MainMenu]])
2007.12.20 [3.0.0] rewrite to track ALL changed tiddlers, including imports and minor edits, regardless of saved modification dates.  Also, rewrote display logic to directly refresh macro output instead of triggering a page refresh.  The entire process is MUCH more efficient now.
2007.08.02 [2.0.0] converted from inline script
2007.01.01 [1.0.0] initial release
&lt;&lt;&lt;
!!!!!Code
***/
//{{{
version.extensions.UnsavedChangesPlugin= {major: 3, minor: 3, revision: 3, date: new Date(2009,3,2)};

config.macros.unsavedChanges = {
	changed: [], // list of currently unsaved tiddler titles
	defMode: &quot;panel&quot;,
	defSep: &quot; &quot;,
	defLabel: &quot;There %1 %0 unsaved tiddler%2...&quot;,
	defTip: &quot;view a list of unsaved tiddler changes&quot;,
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var wrapper=createTiddlyElement(place,&quot;span&quot;,null,&quot;unsavedChanges&quot;);
		wrapper.setAttribute(&quot;mode&quot;,params[0]||this.defMode);
		wrapper.setAttribute(&quot;sep&quot;,params[1]||this.defSep); // for 'list' mode
		wrapper.setAttribute(&quot;label&quot;,params[1]||this.defLabel); // for 'command' mode
		wrapper.setAttribute(&quot;tip&quot;,params[2]||this.defTip); // for 'command' mode
		this.render(wrapper);
	},
	render: function(wrapper) {
		removeChildren(wrapper); // make sure its empty
		if (!this.changed.length) return; // no changes = no output
		switch (wrapper.getAttribute(&quot;mode&quot;)) {
			case &quot;command&quot;: this.command(wrapper); break;
			case &quot;list&quot;: this.list(wrapper); break;
			case &quot;panel&quot;: default: this.panel(wrapper); break;
		}
	},
	refresh: function() {
		var wrappers=document.getElementsByTagName(&quot;span&quot;);
		for (var w=0; w&lt;wrappers.length; w++)
			if (hasClass(wrappers[w],&quot;unsavedChanges&quot;))
				this.render(wrappers[w]);
	},
	list: function(place) { // show simple list of unsaved tiddlers
		wikify(&quot;[[&quot;+this.changed.join(&quot;]]&quot;+place.getAttribute(&quot;sep&quot;)+&quot;[[&quot;)+&quot;]]&quot;,place);
	},
	command: function(place) { // show command link with popup list
		var c=this.changed.length;
		var txt=place.getAttribute(&quot;label&quot;).format([c,c==1?'is':'are',c==1?'':'s']);
		var tip=place.getAttribute(&quot;tip&quot;);
		var action=function(ev) { if (!ev) var ev=window.event;
			var p=Popup.create(this); if (!p) return false;
			var d=createTiddlyElement(p,&quot;div&quot;);
			d.style.whiteSpace=&quot;normal&quot;; d.style.width=&quot;auto&quot;; d.style.padding=&quot;2px&quot;;
			// gather pretty links for changed tiddlers
			var list=[]; var item=&quot; &amp;nbsp;[[%1 - %0 (%2 bytes)|%0]]&amp;nbsp; &quot;;
			for (var i=config.macros.unsavedChanges.changed.length-1; i&gt;=0; i--) {
				var tid=store.getTiddler(config.macros.unsavedChanges.changed[i]);
				if (!tid) continue;
				var when=tid.modified.formatString('YYYY.0MM.0DD 0hh:0mm:0ss');
				list.push(item.format([tid.title,when,tid.text.length]));
			}
			wikify(&quot;@@white-space:nowrap;&quot;+list.join(&quot;&lt;br&gt;&quot;)+&quot;@@&quot;,d);
			if (!readOnly) {
				var t=&quot;\n----\n&quot;;
				t+=&quot;@@white-space:nowrap;display:block;text-align:center; &amp;nbsp;&quot;;
				t+=&quot;&lt;&lt;saveChanges&gt;&gt;&quot;;
				t+=config.macros.saveAs?&quot; | &lt;&lt;saveAs&gt;&gt;&quot;:&quot;&quot;;
				t+=config.macros.upload?&quot; | &lt;&lt;upload&gt;&gt;&quot;:&quot;&quot;;
				t+=(config.macros.emptyTrash&amp;&amp;store.getTaggedTiddlers(&quot;Trash&quot;).length)?&quot; | &lt;&lt;emptyTrash&gt;&gt;&quot;:&quot;&quot;;
				t+=&quot;&amp;nbsp; @@&quot;;
				wikify(t,d);
			}
			Popup.show();
			ev.cancelBubble=true; if(ev.stopPropagation)ev.stopPropagation();
			return(false);
		}
		createTiddlyButton(place,txt,tip,action,&quot;button&quot;);
	},
	panel: function(place) { // show composite droplist+buttons+commands
		// gather changed tiddlers (in reverse order by date - most recent first)
		var tids=[]; for (var i=this.changed.length-1; i&gt;=0; i--)
			{ var t=store.getTiddler(this.changed[i]); if (t) tids.push(t); }
		tids.sort(function(a,b){return a.modified&lt;b.modified?-1:(a.modified==b.modified?0:1);});
		// generate droplist items
 		var list=[]; var item='&lt;option value=&quot;%0&quot;&gt;%1 - %0 (%2 bytes)&lt;/option&gt;';
		for (var i=tids.length-1; i&gt;=0; i--) {
			var when=tids[i].modified.formatString('YYYY.0MM.0DD 0hh:0mm:0ss');
			list.push(item.format([tids[i].title.htmlEncode(),when,tids[i].text.length]));
		}
		// display droplist, buttons, and command links
		var out=''; var c=this.changed.length;
		var NSP=config.formatters.findByField(&quot;name&quot;,&quot;nestedSliders&quot;);
		var summary=this.defLabel.format([c,c==1?'is':'are',c==1?'':'s'])
		out+=NSP?'+++(unsaved)['+summary+'|'+this.defTip+']...':(summary+&quot;\n&quot;);
		out+='&lt;html&gt;&lt;form style=&quot;display:inline&quot;&gt;&lt;!--\
			--&gt;&lt;select size=&quot;1&quot; name=&quot;list&quot; \
				title=&quot;select a tiddler to view&quot; \
				onchange=&quot;var v=this.value; if (v.length) story.displayTiddler(null,v);&quot;&gt;&lt;!--\
			--&gt;'+list.join('')+'&lt;!--\
			--&gt;&lt;/select&gt;&lt;!--\
			--&gt;&lt;input type=&quot;button&quot; value=&quot;goto&quot; onclick=&quot;this.form.list.onchange();&quot;&gt;';
		if (config.macros.loadTiddlers)  {
			out+='&lt;input type=&quot;button&quot; value=&quot;revert&quot; \
				title=&quot;import the last saved version of this tiddler&quot; \
				onclick=&quot;var v=this.form.list.value; if (!v.length) return; \
					var t=\'&lt;\'+\'&lt;loadTiddlers [[tiddler:\'+v+\']] \'; \
					t+=document.location.href; \
					t+=\' confirm force noreport&gt;\'+\'&gt;\'; \
					var e=document.getElementById(\'executeRevert\'); \
					if (e) e.parentNode.removeChild(e); \
					e=document.createElement(\'span\'); \
					e.id=\'executeRevert\'; \
					wikify(t,e);&quot;&gt;';
		}
		out+='&lt;/form&gt;&lt;/html&gt;';
		if (!readOnly) {
			out+='\n{{small nowrap{';
			out+=&quot;&lt;&lt;saveChanges&gt;&gt;&quot;;
			out+=config.macros.saveAs?&quot; | &lt;&lt;saveAs&gt;&gt;&quot;:&quot;&quot;;
			out+=config.macros.upload?&quot; | &lt;&lt;upload&gt;&gt;&quot;:&quot;&quot;;
			out+=(config.macros.emptyTrash&amp;&amp;store.getTaggedTiddlers(&quot;Trash&quot;).length)?&quot; | &lt;&lt;emptyTrash&gt;&gt;&quot;:&quot;&quot;;
			out+='}}}';
		}
		out+=NSP?'===':'';
		wikify(out,place);
	}
};

// hijack store.saveTiddler() to track changes to tiddlers
if (store.showUnsaved_saveTiddler==undefined) {
	store.showUnsaved_saveTiddler=store.saveTiddler;
	store.saveTiddler=function(title,newtitle) {
		if (title!=newtitle) {
			var i=config.macros.unsavedChanges.changed.indexOf(title);
			if (i!=-1) config.macros.unsavedChanges.changed.splice(i,1); // remove old from list
                        displayMessage( &quot;'&quot;+title+&quot;' changes to '&quot;+newtitle+&quot;'&quot;); 
		} 
                displayMessage(&quot;Unsaved '&quot;+newtitle+&quot;'&quot;); 
		var i=config.macros.unsavedChanges.changed.indexOf(newtitle);
		if (i!=-1) config.macros.unsavedChanges.changed.splice(i,1); // remove new title from list
		config.macros.unsavedChanges.changed.push(newtitle); // add new title to END of list
		var t=this.showUnsaved_saveTiddler.apply(this,arguments);
		if (!this.notificationLevel) config.macros.unsavedChanges.refresh();
		return t;
	}
}

// hijack store.removeTiddler() to track changes to tiddlers
if (store.showUnsaved_removeTiddler==undefined) {
	store.showUnsaved_removeTiddler=store.removeTiddler;
	store.removeTiddler=function(title) {
		var i=config.macros.unsavedChanges.changed.indexOf(title);
		if (i!=-1) config.macros.unsavedChanges.changed.splice(i,1); // remove from list
		this.showUnsaved_removeTiddler.apply(this,arguments);
		if (!this.notificationLevel) config.macros.unsavedChanges.refresh();
	}
}

// hijack store.setDirty() function to reset change list after file save
// note: do NOT hijack the prototype function.  This hijack should only be applied to
// the main 'store' instance only (i.e., don't refresh when loading temporary store
// as part of ImportTiddlers processing)
if (store.showUnsaved_setDirty==undefined) {
	store.showUnsaved_setDirty=store.setDirty;
	store.setDirty = function(flag) {
		var refresh=this.isDirty() &amp;&amp; !flag; // 'dirty' to 'clean', force a refresh...
		this.showUnsaved_setDirty.apply(this,arguments); // but change the flag first.
		if (refresh) {
			config.macros.unsavedChanges.changed=[]; // clear changed list
			config.macros.unsavedChanges.refresh();
		}
	}
}
//}}}</pre>
</div>
<div title="YourSearchPlugin" modifier="dger" created="201007170954" modified="201010030933" tags="plugin YourSearchExtension systemConfig %tw-elnb">
<pre>/***
|''Name:''|YourSearchPlugin|
|''Version:''|2.1.5 (2010-02-16)|
|''Source:''|http://tiddlywiki.abego-software.de/#YourSearchPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]|
|''Copyright:''|&amp;copy; 2005-2010 [[abego Software|http://www.abego-software.de]]|
|''~CoreVersion:''|2.1.0|
|''Community:''|[[del.icio.us|http://del.icio.us/post?url=http://tiddlywiki.abego-software.de/index.html%23YourSearchPlugin]]|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; ~InternetExplorer 6.0|
!About YourSearch
YourSearch gives you a bunch of new features to simplify and speed up your daily searches in TiddlyWiki. It seamlessly integrates into the standard TiddlyWiki search: just start typing into the 'search' field and explore!

For more information see [[Help|YourSearch Help]].
!Compatibility
This plugin requires TiddlyWiki 2.1. 
Check the [[archive|http://tiddlywiki.abego-software.de/archive]] for ~YourSearchPlugins supporting older versions of TiddlyWiki.
!Source Code
***/
/***
This plugin's source code is compressed (and hidden). Use this [[link|http://tiddlywiki.abego-software.de/archive/YourSearchPlugin/Plugin-YourSearch-src.2.1.5.js]] to get the readable source code.
***/
///%
if(!version.extensions.YourSearchPlugin){version.extensions.YourSearchPlugin={major:2,minor:1,revision:5,source:&quot;http://tiddlywiki.abego-software.de/#YourSearchPlugin&quot;,licence:&quot;[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]&quot;,copyright:&quot;Copyright (c) abego Software GmbH, 2005-2010 (www.abego-software.de)&quot;};if(!window.abego){window.abego={};}if(!Array.forEach){Array.forEach=function(_1,_2,_3){for(var i=0,_4=_1.length;i&lt;_4;i++){_2.call(_3,_1[i],i,_1);}};Array.prototype.forEach=function(_5,_6){for(var i=0,_7=this.length;i&lt;_7;i++){_5.call(_6,this[i],i,this);}};}abego.toInt=function(s,_8){if(!s){return _8;}var n=parseInt(s);return (n==NaN)?_8:n;};abego.createEllipsis=function(_9){var e=createTiddlyElement(_9,&quot;span&quot;);e.innerHTML=&quot;&amp;hellip;&quot;;};abego.shallowCopy=function(_a){if(!_a){return _a;}var _b={};for(var n in _a){_b[n]=_a[n];}return _b;};abego.copyOptions=function(_c){return !_c?{}:abego.shallowCopy(_c);};abego.countStrings=function(_d,s){if(!s){return 0;}var _e=s.length;var n=0;var _f=0;while(1){var i=_d.indexOf(s,_f);if(i&lt;0){return n;}n++;_f=i+_e;}return n;};abego.getBracedText=function(_10,_11,_12){if(!_11){_11=0;}var re=/\{([^\}]*)\}/gm;re.lastIndex=_11;var m=re.exec(_10);if(m){var s=m[1];var _13=abego.countStrings(s,&quot;{&quot;);if(!_13){if(_12){_12.lastIndex=re.lastIndex;}return s;}var len=_10.length;for(var i=re.lastIndex;i&lt;len&amp;&amp;_13;i++){var c=_10.charAt(i);if(c==&quot;{&quot;){_13++;}else{if(c==&quot;}&quot;){_13--;}}}if(!_13){if(_12){_12.lastIndex=i-1;}return _10.substring(m.index+1,i-1);}}};abego.select=function(_14,_15,_16,_17){if(!_17){_17=[];}_14.forEach(function(t){if(_15.call(_16,t)){_17.push(t);}});return _17;};abego.consumeEvent=function(e){if(e.stopPropagation){e.stopPropagation();}if(e.preventDefault){e.preventDefault();}e.cancelBubble=true;e.returnValue=true;};abego.TiddlerFilterTerm=function(_18,_19){if(!_19){_19={};}var _1a=_18;if(!_19.textIsRegExp){_1a=_18.escapeRegExp();if(_19.fullWordMatch){_1a=&quot;\\b&quot;+_1a+&quot;\\b&quot;;}}var _1b=new RegExp(_1a,&quot;m&quot;+(_19.caseSensitive?&quot;&quot;:&quot;i&quot;));this.tester=new abego.MultiFieldRegExpTester(_1b,_19.fields,_19.withExtendedFields);};abego.TiddlerFilterTerm.prototype.test=function(_1c){return this.tester.test(_1c);};abego.parseNewTiddlerCommandLine=function(s){var m=/(.*?)\.(?:\s+|$)([^#]*)(#.*)?/.exec(s);if(!m){m=/([^#]*)()(#.*)?/.exec(s);}if(m){var r;if(m[3]){var s2=m[3].replace(/#/g,&quot;&quot;);r=s2.parseParams(&quot;tag&quot;);}else{r=[[]];}var _1d=m[2]?m[2].trim():&quot;&quot;;r.push({name:&quot;text&quot;,value:_1d});r[0].text=[_1d];return {title:m[1].trim(),params:r};}else{return {title:s.trim(),params:[[]]};}};abego.parseTiddlerFilterTerm=function(_1e,_1f,_20){var re=/\s*(?:(?:\{([^\}]*)\})|(?:(=)|([#%!])|(?:(\w+)\s*\:(?!\/\/))|(?:(?:(&quot;(?:(?:\\&quot;)|[^&quot;])+&quot;)|(?:\/((?:(?:\\\/)|[^\/])+)\/)|(\w+\:\/\/[^\s]+)|([^\s\)\-\&quot;]+)))))/mg;var _21={&quot;!&quot;:&quot;title&quot;,&quot;%&quot;:&quot;text&quot;,&quot;#&quot;:&quot;tags&quot;};var _22={};var _23;re.lastIndex=_1f;while(1){var i=re.lastIndex;var m=re.exec(_1e);if(!m||m.index!=i){throw &quot;Word or String literal expected&quot;;}if(m[1]){var _24={};var _25=abego.getBracedText(_1e,0,_24);if(!_25){throw &quot;Invalid {...} syntax&quot;;}var f=Function(&quot;tiddler&quot;,&quot;return (&quot;+_25+&quot;);&quot;);return {func:f,lastIndex:_24.lastIndex,markRE:null};}if(m[2]){_23=true;}else{if(m[3]){_22[_21[m[3]]]=1;}else{if(m[4]){_22[m[4]]=1;}else{var _26=m[6];var _27=m[5]?window.eval(m[5]):m[6]?m[6]:m[7]?m[7]:m[8];var _20=abego.copyOptions(_20);_20.fullWordMatch=_23;_20.textIsRegExp=_26;var _28=[];for(var n in _22){_28.push(n);}if(_28.length==0){_20.fields=_20.defaultFields;}else{_20.fields=_28;_20.withExtendedFields=false;}var _29=new abego.TiddlerFilterTerm(_27,_20);var _2a=_26?_27:_27.escapeRegExp();if(_2a&amp;&amp;_23){_2a=&quot;\\b&quot;+_2a+&quot;\\b&quot;;}return {func:function(_2b){return _29.test(_2b);},lastIndex:re.lastIndex,markRE:_2a?&quot;(?:&quot;+_2a+&quot;)&quot;:null};}}}}};abego.BoolExp=function(s,_2c,_2d){this.s=s;var _2e=_2d&amp;&amp;_2d.defaultOperationIs_OR;var _2f=/\s*(?:(\-|not)|(\())/gi;var _30=/\s*\)/g;var _31=/\s*(?:(and|\&amp;\&amp;)|(or|\|\|))/gi;var _32=/\s*[^\)\s]/g;var _33=/\s*(\-|not)?(\s*\()?/gi;var _34;var _35=function(_36){_33.lastIndex=_36;var m=_33.exec(s);var _37;var _38;if(m&amp;&amp;m.index==_36){_36+=m[0].length;_37=m[1];if(m[2]){var e=_34(_36);_30.lastIndex=e.lastIndex;if(!_30.exec(s)){throw &quot;Missing ')'&quot;;}_38={func:e.func,lastIndex:_30.lastIndex,markRE:e.markRE};}}if(!_38){_38=_2c(s,_36,_2d);}if(_37){_38.func=(function(f){return function(_39){return !f(_39);};})(_38.func);_38.markRE=null;}return _38;};_34=function(_3a){var _3b=_35(_3a);while(1){var l=_3b.lastIndex;_31.lastIndex=l;var m=_31.exec(s);var _3c;var _3d;if(m&amp;&amp;m.index==l){_3c=!m[1];_3d=_35(_31.lastIndex);}else{try{_3d=_35(l);}catch(e){return _3b;}_3c=_2e;}_3b.func=(function(_3e,_3f,_40){return _40?function(_41){return _3e(_41)||_3f(_41);}:function(_42){return _3e(_42)&amp;&amp;_3f(_42);};})(_3b.func,_3d.func,_3c);_3b.lastIndex=_3d.lastIndex;if(!_3b.markRE){_3b.markRE=_3d.markRE;}else{if(_3d.markRE){_3b.markRE=_3b.markRE+&quot;|&quot;+_3d.markRE;}}}};var _43=_34(0);this.evalFunc=_43.func;if(_43.markRE){this.markRegExp=new RegExp(_43.markRE,_2d.caseSensitive?&quot;mg&quot;:&quot;img&quot;);}};abego.BoolExp.prototype.exec=function(){return this.evalFunc.apply(this,arguments);};abego.BoolExp.prototype.getMarkRegExp=function(){return this.markRegExp;};abego.BoolExp.prototype.toString=function(){return this.s;};abego.MultiFieldRegExpTester=function(re,_44,_45){this.re=re;this.fields=_44?_44:[&quot;title&quot;,&quot;text&quot;,&quot;tags&quot;];this.withExtendedFields=_45;};abego.MultiFieldRegExpTester.prototype.test=function(_46){var re=this.re;for(var i=0;i&lt;this.fields.length;i++){var s=store.getValue(_46,this.fields[i]);if(typeof s==&quot;string&quot;&amp;&amp;re.test(s)){return this.fields[i];}}if(this.withExtendedFields){return store.forEachField(_46,function(_47,_48,_49){return typeof _49==&quot;string&quot;&amp;&amp;re.test(_49)?_48:null;},true);}return null;};abego.TiddlerQuery=function(_4a,_4b,_4c,_4d,_4e){if(_4c){this.regExp=new RegExp(_4a,_4b?&quot;mg&quot;:&quot;img&quot;);this.tester=new abego.MultiFieldRegExpTester(this.regExp,_4d,_4e);}else{this.expr=new abego.BoolExp(_4a,abego.parseTiddlerFilterTerm,{defaultFields:_4d,caseSensitive:_4b,withExtendedFields:_4e});}this.getQueryText=function(){return _4a;};this.getUseRegExp=function(){return _4c;};this.getCaseSensitive=function(){return _4b;};this.getDefaultFields=function(){return _4d;};this.getWithExtendedFields=function(){return _4e;};};abego.TiddlerQuery.prototype.test=function(_4f){if(!_4f){return false;}if(this.regExp){return this.tester.test(_4f);}return this.expr.exec(_4f);};abego.TiddlerQuery.prototype.filter=function(_50){return abego.select(_50,this.test,this);};abego.TiddlerQuery.prototype.getMarkRegExp=function(){if(this.regExp){return &quot;&quot;.search(this.regExp)&gt;=0?null:this.regExp;}return this.expr.getMarkRegExp();};abego.TiddlerQuery.prototype.toString=function(){return (this.regExp?this.regExp:this.expr).toString();};abego.PageWiseRenderer=function(){this.firstIndexOnPage=0;};merge(abego.PageWiseRenderer.prototype,{setItems:function(_51){this.items=_51;this.setFirstIndexOnPage(0);},getMaxPagesInNavigation:function(){return 10;},getItemsCount:function(_52){return this.items?this.items.length:0;},getCurrentPageIndex:function(){return Math.floor(this.firstIndexOnPage/this.getItemsPerPage());},getLastPageIndex:function(){return Math.floor((this.getItemsCount()-1)/this.getItemsPerPage());},setFirstIndexOnPage:function(_53){this.firstIndexOnPage=Math.min(Math.max(0,_53),this.getItemsCount()-1);},getFirstIndexOnPage:function(){this.firstIndexOnPage=Math.floor(this.firstIndexOnPage/this.getItemsPerPage())*this.getItemsPerPage();return this.firstIndexOnPage;},getLastIndexOnPage:function(){return Math.min(this.getFirstIndexOnPage()+this.getItemsPerPage()-1,this.getItemsCount()-1);},onPageChanged:function(_54,_55){},renderPage:function(_56){if(_56.beginRendering){_56.beginRendering(this);}try{if(this.getItemsCount()){var _57=this.getLastIndexOnPage();var _58=-1;for(var i=this.getFirstIndexOnPage();i&lt;=_57;i++){_58++;_56.render(this,this.items[i],i,_58);}}}finally{if(_56.endRendering){_56.endRendering(this);}}},addPageNavigation:function(_59){if(!this.getItemsCount()){return;}var _5a=this;var _5b=function(e){if(!e){var e=window.event;}abego.consumeEvent(e);var _5c=abego.toInt(this.getAttribute(&quot;page&quot;),0);var _5d=_5a.getCurrentPageIndex();if(_5c==_5d){return;}var _5e=_5c*_5a.getItemsPerPage();_5a.setFirstIndexOnPage(_5e);_5a.onPageChanged(_5c,_5d);};var _5f;var _60=this.getCurrentPageIndex();var _61=this.getLastPageIndex();if(_60&gt;0){_5f=createTiddlyButton(_59,&quot;Previous&quot;,&quot;Go to previous page (Shortcut: Alt-'&lt;')&quot;,_5b,&quot;prev&quot;);_5f.setAttribute(&quot;page&quot;,(_60-1).toString());_5f.setAttribute(&quot;accessKey&quot;,&quot;&lt;&quot;);}for(var i=-this.getMaxPagesInNavigation();i&lt;this.getMaxPagesInNavigation();i++){var _62=_60+i;if(_62&lt;0){continue;}if(_62&gt;_61){break;}var _63=(i+_60+1).toString();var _64=_62==_60?&quot;currentPage&quot;:&quot;otherPage&quot;;_5f=createTiddlyButton(_59,_63,&quot;Go to page %0&quot;.format([_63]),_5b,_64);_5f.setAttribute(&quot;page&quot;,(_62).toString());}if(_60&lt;_61){_5f=createTiddlyButton(_59,&quot;Next&quot;,&quot;Go to next page (Shortcut: Alt-'&gt;')&quot;,_5b,&quot;next&quot;);_5f.setAttribute(&quot;page&quot;,(_60+1).toString());_5f.setAttribute(&quot;accessKey&quot;,&quot;&gt;&quot;);}}});abego.LimitedTextRenderer=function(){var _65=40;var _66=4;var _67=function(_68,_69,_6a){var n=_68.length;if(n==0){_68.push({start:_69,end:_6a});return;}var i=0;for(;i&lt;n;i++){var _6b=_68[i];if(_6b.start&lt;=_6a&amp;&amp;_69&lt;=_6b.end){var r;var _6c=i+1;for(;_6c&lt;n;_6c++){r=_68[_6c];if(r.start&gt;_6a||_69&gt;_6b.end){break;}}var _6d=_69;var _6e=_6a;for(var j=i;j&lt;_6c;j++){r=_68[j];_6d=Math.min(_6d,r.start);_6e=Math.max(_6e,r.end);}_68.splice(i,_6c-i,{start:_6d,end:_6e});return;}if(_6b.start&gt;_6a){break;}}_68.splice(i,0,{start:_69,end:_6a});};var _6f=function(_70){var _71=0;for(var i=0;i&lt;_70.length;i++){var _72=_70[i];_71+=_72.end-_72.start;}return _71;};var _73=function(c){return (c&gt;=&quot;a&quot;&amp;&amp;c&lt;=&quot;z&quot;)||(c&gt;=&quot;A&quot;&amp;&amp;c&lt;=&quot;Z&quot;)||c==&quot;_&quot;;};var _74=function(s,_75){if(!_73(s[_75])){return null;}for(var i=_75-1;i&gt;=0&amp;&amp;_73(s[i]);i--){}var _76=i+1;var n=s.length;for(i=_75+1;i&lt;n&amp;&amp;_73(s[i]);i++){}return {start:_76,end:i};};var _77=function(s,_78,_79){var _7a;if(_79){_7a=_74(s,_78);}else{if(_78&lt;=0){return _78;}_7a=_74(s,_78-1);}if(!_7a){return _78;}if(_79){if(_7a.start&gt;=_78-_66){return _7a.start;}if(_7a.end&lt;=_78+_66){return _7a.end;}}else{if(_7a.end&lt;=_78+_66){return _7a.end;}if(_7a.start&gt;=_78-_66){return _7a.start;}}return _78;};var _7b=function(s,_7c){var _7d=[];if(_7c){var _7e=0;var n=s.length;var _7f=0;do{_7c.lastIndex=_7e;var _80=_7c.exec(s);if(_80){if(_7e&lt;_80.index){var t=s.substring(_7e,_80.index);_7d.push({text:t});}_7d.push({text:_80[0],isMatch:true});_7e=_80.index+_80[0].length;}else{_7d.push({text:s.substr(_7e)});break;}}while(true);}else{_7d.push({text:s});}return _7d;};var _81=function(_82){var _83=0;for(var i=0;i&lt;_82.length;i++){if(_82[i].isMatch){_83++;}}return _83;};var _84=function(s,_85,_86,_87,_88){var _89=Math.max(Math.floor(_88/(_87+1)),_65);var _8a=Math.max(_89-(_86-_85),0);var _8b=Math.min(Math.floor(_86+_8a/3),s.length);var _8c=Math.max(_8b-_89,0);_8c=_77(s,_8c,true);_8b=_77(s,_8b,false);return {start:_8c,end:_8b};};var _8d=function(_8e,s,_8f){var _90=[];var _91=_81(_8e);var pos=0;for(var i=0;i&lt;_8e.length;i++){var t=_8e[i];var _92=t.text;if(t.isMatch){var _93=_84(s,pos,pos+_92.length,_91,_8f);_67(_90,_93.start,_93.end);}pos+=_92.length;}return _90;};var _94=function(s,_95,_96){var _97=_96-_6f(_95);while(_97&gt;0){if(_95.length==0){_67(_95,0,_77(s,_96,false));return;}else{var _98=_95[0];var _99;var _9a;if(_98.start==0){_99=_98.end;if(_95.length&gt;1){_9a=_95[1].start;}else{_67(_95,_99,_77(s,_99+_97,false));return;}}else{_99=0;_9a=_98.start;}var _9b=Math.min(_9a,_99+_97);_67(_95,_99,_9b);_97-=(_9b-_99);}}};var _9c=function(_9d,s,_9e,_9f,_a0){if(_9f.length==0){return;}var _a1=function(_a2,s,_a3,_a4,_a5){var t;var _a6;var pos=0;var i=0;var _a7=0;for(;i&lt;_a3.length;i++){t=_a3[i];_a6=t.text;if(_a4&lt;pos+_a6.length){_a7=_a4-pos;break;}pos+=_a6.length;}var _a8=_a5-_a4;for(;i&lt;_a3.length&amp;&amp;_a8&gt;0;i++){t=_a3[i];_a6=t.text.substr(_a7);_a7=0;if(_a6.length&gt;_a8){_a6=_a6.substr(0,_a8);}if(t.isMatch){createTiddlyElement(_a2,&quot;span&quot;,null,&quot;marked&quot;,_a6);}else{createTiddlyText(_a2,_a6);}_a8-=_a6.length;}if(_a5&lt;s.length){abego.createEllipsis(_a2);}};if(_9f[0].start&gt;0){abego.createEllipsis(_9d);}var _a9=_a0;for(var i=0;i&lt;_9f.length&amp;&amp;_a9&gt;0;i++){var _aa=_9f[i];var len=Math.min(_aa.end-_aa.start,_a9);_a1(_9d,s,_9e,_aa.start,_aa.start+len);_a9-=len;}};this.render=function(_ab,s,_ac,_ad){if(s.length&lt;_ac){_ac=s.length;}var _ae=_7b(s,_ad);var _af=_8d(_ae,s,_ac);_94(s,_af,_ac);_9c(_ab,s,_ae,_af,_ac);};};(function(){function _b0(msg){alert(msg);throw msg;};if(version.major&lt;2||(version.major==2&amp;&amp;version.minor&lt;1)){_b0(&quot;YourSearchPlugin requires TiddlyWiki 2.1 or newer.\n\nCheck the archive for YourSearch plugins\nsupporting older versions of TiddlyWiki.\n\nArchive: http://tiddlywiki.abego-software.de/archive&quot;);}abego.YourSearch={};var _b1;var _b2;var _b3=function(_b4){_b1=_b4;};var _b5=function(){return _b1?_b1:[];};var _b6=function(){return _b1?_b1.length:0;};var _b7=4;var _b8=10;var _b9=2;var _ba=function(s,re){var m=s.match(re);return m?m.length:0;};var _bb=function(_bc,_bd){var _be=_bd.getMarkRegExp();if(!_be){return 1;}var _bf=_bc.title.match(_be);var _c0=_bf?_bf.length:0;var _c1=_ba(_bc.getTags(),_be);var _c2=_bf?_bf.join(&quot;&quot;).length:0;var _c3=_bc.title.length&gt;0?_c2/_bc.title.length:0;var _c4=_c0*_b7+_c1*_b9+_c3*_b8+1;return _c4;};var _c5=function(_c6,_c7,_c8,_c9,_ca,_cb){_b2=null;var _cc=_c6.reverseLookup(&quot;tags&quot;,_cb,false);try{var _cd=[];if(config.options.chkSearchInTitle){_cd.push(&quot;title&quot;);}if(config.options.chkSearchInText){_cd.push(&quot;text&quot;);}if(config.options.chkSearchInTags){_cd.push(&quot;tags&quot;);}_b2=new abego.TiddlerQuery(_c7,_c8,_c9,_cd,config.options.chkSearchExtendedFields);}catch(e){return [];}var _ce=_b2.filter(_cc);var _cf=abego.YourSearch.getRankFunction();for(var i=0;i&lt;_ce.length;i++){var _d0=_ce[i];var _d1=_cf(_d0,_b2);_d0.searchRank=_d1;}if(!_ca){_ca=&quot;title&quot;;}var _d2=function(a,b){var _d3=a.searchRank-b.searchRank;if(_d3==0){if(a[_ca]==b[_ca]){return (0);}else{return (a[_ca]&lt;b[_ca])?-1:+1;}}else{return (_d3&gt;0)?-1:+1;}};_ce.sort(_d2);return _ce;};var _d4=80;var _d5=50;var _d6=250;var _d7=50;var _d8=25;var _d9=10;var _da=&quot;yourSearchResult&quot;;var _db=&quot;yourSearchResultItems&quot;;var _dc;var _dd;var _de;var _df;var _e0;var _e1=function(){if(version.extensions.YourSearchPlugin.styleSheetInited){return;}version.extensions.YourSearchPlugin.styleSheetInited=true;setStylesheet(store.getTiddlerText(&quot;YourSearchStyleSheet&quot;),&quot;yourSearch&quot;);};var _e2=function(){return _dd!=null&amp;&amp;_dd.parentNode==document.body;};var _e3=function(){if(_e2()){document.body.removeChild(_dd);}};var _e4=function(e){_e3();var _e5=this.getAttribute(&quot;tiddlyLink&quot;);if(_e5){var _e6=this.getAttribute(&quot;withHilite&quot;);var _e7=highlightHack;if(_e6&amp;&amp;_e6==&quot;true&quot;&amp;&amp;_b2){highlightHack=_b2.getMarkRegExp();}story.displayTiddler(this,_e5);highlightHack=_e7;}return (false);};var _e8=function(){if(!_de){return;}var _e9=_de;var _ea=findPosX(_e9);var _eb=findPosY(_e9);var _ec=_e9.offsetHeight;var _ed=_ea;var _ee=_eb+_ec;var _ef=findWindowWidth();if(_ef&lt;_dd.offsetWidth){_dd.style.width=(_ef-100)+&quot;px&quot;;_ef=findWindowWidth();}var _f0=_dd.offsetWidth;if(_ed+_f0&gt;_ef){_ed=_ef-_f0-30;}if(_ed&lt;0){_ed=0;}_dd.style.left=_ed+&quot;px&quot;;_dd.style.top=_ee+&quot;px&quot;;_dd.style.display=&quot;block&quot;;};var _f1=function(){if(_dd){window.scrollTo(0,ensureVisible(_dd));}if(_de){window.scrollTo(0,ensureVisible(_de));}};var _f2=function(){_e8();_f1();};var _f3;var _f4;var _f5=new abego.PageWiseRenderer();var _f6=function(_f7){this.itemHtml=store.getTiddlerText(&quot;YourSearchItemTemplate&quot;);if(!this.itemHtml){_b0(&quot;YourSearchItemTemplate not found&quot;);}this.place=document.getElementById(_db);if(!this.place){this.place=createTiddlyElement(_f7,&quot;div&quot;,_db);}};merge(_f6.prototype,{render:function(_f8,_f9,_fa,_fb){_f3=_fb;_f4=_f9;var _fc=createTiddlyElement(this.place,&quot;div&quot;,null,&quot;yourSearchItem&quot;);_fc.innerHTML=this.itemHtml;applyHtmlMacros(_fc,null);refreshElements(_fc,null);},endRendering:function(_fd){_f4=null;}});var _fe=function(){if(!_dd||!_de){return;}var _ff=store.getTiddlerText(&quot;YourSearchResultTemplate&quot;);if(!_ff){_ff=&quot;&lt;b&gt;Tiddler YourSearchResultTemplate not found&lt;/b&gt;&quot;;}_dd.innerHTML=_ff;applyHtmlMacros(_dd,null);refreshElements(_dd,null);var _100=new _f6(_dd);_f5.renderPage(_100);_f2();};_f5.getItemsPerPage=function(){var n=(config.options.chkPreviewText)?abego.toInt(config.options.txtItemsPerPageWithPreview,_d9):abego.toInt(config.options.txtItemsPerPage,_d8);return (n&gt;0)?n:1;};_f5.onPageChanged=function(){_fe();};var _101=function(){if(_de==null||!config.options.chkUseYourSearch){return;}if((_de.value==_dc)&amp;&amp;_dc&amp;&amp;!_e2()){if(_dd&amp;&amp;(_dd.parentNode!=document.body)){document.body.appendChild(_dd);_f2();}else{abego.YourSearch.onShowResult(true);}}};var _102=function(){_e3();_dd=null;_dc=null;};var _103=function(self,e){while(e!=null){if(self==e){return true;}e=e.parentNode;}return false;};var _104=function(e){if(e.target==_de){return;}if(e.target==_df){return;}if(_dd&amp;&amp;_103(_dd,e.target)){return;}_e3();};var _105=function(e){if(e.keyCode==27){_e3();}};addEvent(document,&quot;click&quot;,_104);addEvent(document,&quot;keyup&quot;,_105);var _106=function(text,_107,_108){_dc=text;_b3(_c5(store,text,_107,_108,&quot;title&quot;,&quot;excludeSearch&quot;));abego.YourSearch.onShowResult();};var _109=function(_10a,_10b,_10c,_10d,_10e,_10f){_e1();_dc=&quot;&quot;;var _110=null;var _111=function(txt){if(config.options.chkUseYourSearch){_106(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);}else{story.search(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);}_dc=txt.value;};var _112=function(e){_111(_de);return false;};var _113=function(e){if(!e){var e=window.event;}_de=this;switch(e.keyCode){case 13:if(e.ctrlKey&amp;&amp;_e0&amp;&amp;_e2()){_e0.onclick.apply(_e0,[e]);}else{_111(this);}break;case 27:if(_e2()){_e3();}else{this.value=&quot;&quot;;clearMessage();}break;}if(String.fromCharCode(e.keyCode)==this.accessKey||e.altKey){_101();}if(this.value.length&lt;3&amp;&amp;_110){clearTimeout(_110);}if(this.value.length&gt;2){if(this.value!=_dc){if(!config.options.chkUseYourSearch||config.options.chkSearchAsYouType){if(_110){clearTimeout(_110);}var txt=this;_110=setTimeout(function(){_111(txt);},500);}}else{if(_110){clearTimeout(_110);}}}if(this.value.length==0){_e3();}};var _114=function(e){this.select();clearMessage();_101();};var args=_10e.parseParams(&quot;list&quot;,null,true);var _115=getFlag(args,&quot;buttonAtRight&quot;);var _116=getParam(args,&quot;sizeTextbox&quot;,this.sizeTextbox);var btn;if(!_115){btn=createTiddlyButton(_10a,this.label,this.prompt,_112);}var txt=createTiddlyElement(null,&quot;input&quot;,null,&quot;txtOptionInput searchField&quot;,null);if(_10c[0]){txt.value=_10c[0];}txt.onkeyup=_113;txt.onfocus=_114;txt.setAttribute(&quot;size&quot;,_116);txt.setAttribute(&quot;accessKey&quot;,this.accessKey);txt.setAttribute(&quot;autocomplete&quot;,&quot;off&quot;);if(config.browser.isSafari){txt.setAttribute(&quot;type&quot;,&quot;search&quot;);txt.setAttribute(&quot;results&quot;,&quot;5&quot;);}else{txt.setAttribute(&quot;type&quot;,&quot;text&quot;);}if(_10a){_10a.appendChild(txt);}if(_115){btn=createTiddlyButton(_10a,this.label,this.prompt,_112);}_de=txt;_df=btn;};var _117=function(){_e3();var _118=_b5();var n=_118.length;if(n){var _119=[];for(var i=0;i&lt;n;i++){_119.push(_118[i].title);}story.displayTiddlers(null,_119);}};var _11a=function(_11b,_11c,_11d,_11e){invokeMacro(_11b,&quot;option&quot;,_11c,_11d,_11e);var elem=_11b.lastChild;var _11f=elem.onclick;elem.onclick=function(e){var _120=_11f.apply(this,arguments);_fe();return _120;};return elem;};var _121=function(s){var _122=[&quot;''&quot;,&quot;{{{&quot;,&quot;}}}&quot;,&quot;//&quot;,&quot;&lt;&lt;&lt;&quot;,&quot;/***&quot;,&quot;***/&quot;];var _123=&quot;&quot;;for(var i=0;i&lt;_122.length;i++){if(i!=0){_123+=&quot;|&quot;;}_123+=&quot;(&quot;+_122[i].escapeRegExp()+&quot;)&quot;;}return s.replace(new RegExp(_123,&quot;mg&quot;),&quot;&quot;).trim();};var _124=function(){var i=_f3;return (i&gt;=0&amp;&amp;i&lt;=9)?(i&lt;9?(i+1):0):-1;};var _125=new abego.LimitedTextRenderer();var _126=function(_127,s,_128){_125.render(_127,s,_128,_b2.getMarkRegExp());};var _129=TiddlyWiki.prototype.saveTiddler;TiddlyWiki.prototype.saveTiddler=function(_12a,_12b,_12c,_12d,_12e,tags,_12f){_129.apply(this,arguments);_102();};var _130=TiddlyWiki.prototype.removeTiddler;TiddlyWiki.prototype.removeTiddler=function(_131){_130.apply(this,arguments);_102();};config.macros.yourSearch={label:&quot;yourSearch&quot;,prompt:&quot;Gives access to the current/last YourSearch result&quot;,handler:function(_132,_133,_134,_135,_136,_137){if(_134.length==0){return;}var name=_134[0];var func=config.macros.yourSearch.funcs[name];if(func){func(_132,_133,_134,_135,_136,_137);}},tests:{&quot;true&quot;:function(){return true;},&quot;false&quot;:function(){return false;},&quot;found&quot;:function(){return _b6()&gt;0;},&quot;previewText&quot;:function(){return config.options.chkPreviewText;}},funcs:{itemRange:function(_138){if(_b6()){var _139=_f5.getLastIndexOnPage();var s=&quot;%0 - %1&quot;.format([_f5.getFirstIndexOnPage()+1,_139+1]);createTiddlyText(_138,s);}},count:function(_13a){createTiddlyText(_13a,_b6().toString());},query:function(_13b){if(_b2){createTiddlyText(_13b,_b2.toString());}},version:function(_13c){var t=&quot;YourSearch %0.%1.%2&quot;.format([version.extensions.YourSearchPlugin.major,version.extensions.YourSearchPlugin.minor,version.extensions.YourSearchPlugin.revision]);var e=createTiddlyElement(_13c,&quot;a&quot;);e.setAttribute(&quot;href&quot;,&quot;http://tiddlywiki.abego-software.de/#YourSearchPlugin&quot;);e.innerHTML=&quot;&lt;font color=\&quot;black\&quot; face=\&quot;Arial, Helvetica, sans-serif\&quot;&gt;&quot;+t+&quot;&lt;font&gt;&quot;;},copyright:function(_13d){var e=createTiddlyElement(_13d,&quot;a&quot;);e.setAttribute(&quot;href&quot;,&quot;http://www.abego-software.de&quot;);e.innerHTML=&quot;&lt;font color=\&quot;black\&quot; face=\&quot;Arial, Helvetica, sans-serif\&quot;&gt;&amp;copy; 2005-2008 &lt;b&gt;&lt;font color=\&quot;red\&quot;&gt;abego&lt;/font&gt;&lt;/b&gt; Software&lt;font&gt;&quot;;},newTiddlerButton:function(_13e){if(_b2){var r=abego.parseNewTiddlerCommandLine(_b2.getQueryText());var btn=config.macros.newTiddler.createNewTiddlerButton(_13e,r.title,r.params,&quot;new tiddler&quot;,&quot;Create a new tiddler based on search text. (Shortcut: Ctrl-Enter; Separators: '.', '#')&quot;,null,&quot;text&quot;);var _13f=btn.onclick;btn.onclick=function(){_e3();_13f.apply(this,arguments);};_e0=btn;}},linkButton:function(_140,_141,_142,_143,_144,_145){if(_142&lt;2){return;}var _146=_142[1];var text=_142&lt;3?_146:_142[2];var _147=_142&lt;4?text:_142[3];var _148=_142&lt;5?null:_142[4];var btn=createTiddlyButton(_140,text,_147,_e4,null,null,_148);btn.setAttribute(&quot;tiddlyLink&quot;,_146);},closeButton:function(_149,_14a,_14b,_14c,_14d,_14e){var _14f=createTiddlyButton(_149,&quot;close&quot;,&quot;Close the Search Results (Shortcut: ESC)&quot;,_e3);},openAllButton:function(_150,_151,_152,_153,_154,_155){var n=_b6();if(n==0){return;}var _156=n==1?&quot;open tiddler&quot;:&quot;open all %0 tiddlers&quot;.format([n]);var _157=createTiddlyButton(_150,_156,&quot;Open all found tiddlers (Shortcut: Alt-O)&quot;,_117);_157.setAttribute(&quot;accessKey&quot;,&quot;O&quot;);},naviBar:function(_158,_159,_15a,_15b,_15c,_15d){_f5.addPageNavigation(_158);},&quot;if&quot;:function(_15e,_15f,_160,_161,_162,_163){if(_160.length&lt;2){return;}var _164=_160[1];var _165=(_164==&quot;not&quot;);if(_165){if(_160.length&lt;3){return;}_164=_160[2];}var test=config.macros.yourSearch.tests[_164];var _166=false;try{if(test){_166=test(_15e,_15f,_160,_161,_162,_163)!=_165;}else{_166=(!eval(_164))==_165;}}catch(ex){}if(!_166){_15e.style.display=&quot;none&quot;;}},chkPreviewText:function(_167,_168,_169,_16a,_16b,_16c){var _16d=_169.slice(1).join(&quot; &quot;);var elem=_11a(_167,&quot;chkPreviewText&quot;,_16a,_16c);elem.setAttribute(&quot;accessKey&quot;,&quot;P&quot;);elem.title=&quot;Show text preview of found tiddlers (Shortcut: Alt-P)&quot;;return elem;}}};config.macros.foundTiddler={label:&quot;foundTiddler&quot;,prompt:&quot;Provides information on the tiddler currently processed on the YourSearch result page&quot;,handler:function(_16e,_16f,_170,_171,_172,_173){var name=_170[0];var func=config.macros.foundTiddler.funcs[name];if(func){func(_16e,_16f,_170,_171,_172,_173);}},funcs:{title:function(_174,_175,_176,_177,_178,_179){if(!_f4){return;}var _17a=_124();var _17b=_17a&gt;=0?&quot;Open tiddler (Shortcut: Alt-%0)&quot;.format([_17a.toString()]):&quot;Open tiddler&quot;;var btn=createTiddlyButton(_174,null,_17b,_e4,null);btn.setAttribute(&quot;tiddlyLink&quot;,_f4.title);btn.setAttribute(&quot;withHilite&quot;,&quot;true&quot;);_126(btn,_f4.title,_d4);if(_17a&gt;=0){btn.setAttribute(&quot;accessKey&quot;,_17a.toString());}},tags:function(_17c,_17d,_17e,_17f,_180,_181){if(!_f4){return;}_126(_17c,_f4.getTags(),_d5);},text:function(_182,_183,_184,_185,_186,_187){if(!_f4){return;}_126(_182,_121(_f4.text),_d6);},field:function(_188,_189,_18a,_18b,_18c,_18d){if(!_f4){return;}var name=_18a[1];var len=_18a.length&gt;2?abego.toInt(_18a[2],_d7):_d7;var v=store.getValue(_f4,name);if(v){_126(_188,_121(v),len);}},number:function(_18e,_18f,_190,_191,_192,_193){var _194=_124();if(_194&gt;=0){var text=&quot;%0)&quot;.format([_194.toString()]);createTiddlyElement(_18e,&quot;span&quot;,null,&quot;shortcutNumber&quot;,text);}}}};var opts={chkUseYourSearch:true,chkPreviewText:true,chkSearchAsYouType:true,chkSearchInTitle:true,chkSearchInText:true,chkSearchInTags:true,chkSearchExtendedFields:true,txtItemsPerPage:_d8,txtItemsPerPageWithPreview:_d9};for(var n in opts){if(config.options[n]==undefined){config.options[n]=opts[n];}}config.shadowTiddlers.AdvancedOptions+=&quot;\n&lt;&lt;option chkUseYourSearch&gt;&gt; Use 'Your Search' //([[more options|YourSearch Options]]) ([[help|YourSearch Help]])// &quot;;config.shadowTiddlers[&quot;YourSearch Help&quot;]=&quot;!Field Search\nWith the Field Search you can restrict your search to certain fields of a tiddler, e.g&quot;+&quot; only search the tags or only the titles. The general form is //fieldname//'':''//textToSearch// (e.&quot;+&quot;g. {{{title:intro}}}). In addition one-character shortcuts are also supported for the standard field&quot;+&quot;s {{{title}}}, {{{text}}} and {{{tags}}}:\n|!What you want|!What you type|!Example|\n|Search ''titles &quot;+&quot;only''|start word with ''!''|{{{!jonny}}} (shortcut for {{{title:jonny}}})|\n|Search ''contents/text &quot;+&quot;only''|start word with ''%''|{{{%football}}} (shortcut for {{{text:football}}})|\n|Search ''tags only&quot;+&quot;''|start word with ''#''|{{{#Plugin}}} (shortcut for {{{tags:Plugin}}})|\n\nUsing this feature you may&quot;+&quot; also search the extended fields (\&quot;Metadata\&quot;) introduced with TiddlyWiki 2.1, e.g. use {{{priority:1&quot;+&quot;}}} to find all tiddlers with the priority field set to \&quot;1\&quot;.\n\nYou may search a word in more than one&quot;+&quot; field. E.g. {{{!#Plugin}}} (or {{{title:tags:Plugin}}} in the \&quot;long form\&quot;) finds tiddlers containin&quot;+&quot;g \&quot;Plugin\&quot; either in the title or in the tags (but does not look for \&quot;Plugin\&quot; in the text). \n\n!Boole&quot;+&quot;an Search\nThe Boolean Search is useful when searching for multiple words.\n|!What you want|!What you &quot;+&quot;type|!Example|\n|''All words'' must exist|List of words|{{{jonny jeremy}}} (or {{{jonny and jeremy}}}&quot;+&quot;)|\n|''At least one word'' must exist|Separate words by ''or''|{{{jonny or jeremy}}}|\n|A word ''must &quot;+&quot;not exist''|Start word with ''-''|{{{-jonny}}} (or {{{not jonny}}})|\n\n''Note:'' When you specify two&quot;+&quot; words, separated with a space, YourSearch finds all tiddlers that contain both words, but not neces&quot;+&quot;sarily next to each other. If you want to find a sequence of word, e.g. '{{{John Brown}}}', you need&quot;+&quot; to put the words into quotes. I.e. you type: {{{\&quot;john brown\&quot;}}}.\n\nUsing parenthesis you may change &quot;+&quot;the default \&quot;left to right\&quot; evaluation of the boolean search. E.g. {{{not (jonny or jeremy)}}} finds&quot;+&quot; all tiddlers that contain neither \&quot;jonny\&quot; nor \&quot;jeremy. In contrast to this {{{not jonny or jeremy}}&quot;+&quot;} (i.e. without parenthesis) finds all tiddlers that either don't contain \&quot;jonny\&quot; or that contain \&quot;j&quot;+&quot;eremy\&quot;.\n\n!'Exact Word' Search\nBy default a search result all matches that 'contain' the searched tex&quot;+&quot;t. E.g. if you search for {{{Task}}} you will get all tiddlers containing 'Task', but also '~Complet&quot;+&quot;edTask', '~TaskForce' etc.\n\nIf you only want to get the tiddlers that contain 'exactly the word' you&quot;+&quot; need to prefix it with a '='. E.g. typing '=Task' will find the tiddlers that contain the word 'Tas&quot;+&quot;k', ignoring words that just contain 'Task' as a substring.\n\n!~CaseSensitiveSearch and ~RegExpSearch&quot;+&quot;\nThe standard search options ~CaseSensitiveSearch and ~RegExpSearch are fully supported by YourSearc&quot;+&quot;h. However when ''~RegExpSearch'' is on Filtered and Boolean Search are disabled.\n\nIn addition you m&quot;+&quot;ay do a \&quot;regular expression\&quot; search even with the ''~RegExpSearch'' set to false by directly enterin&quot;+&quot;g the regular expression into the search field, framed with {{{/.../}}}. \n\nExample: {{{/m[ae][iy]er/&quot;+&quot;}}} will find all tiddlers that contain either \&quot;maier\&quot;, \&quot;mayer\&quot;, \&quot;meier\&quot; or \&quot;meyer\&quot;.\n\n!~JavaScript E&quot;+&quot;xpression Filtering\nIf you are familiar with JavaScript programming and know some TiddlyWiki interna&quot;+&quot;ls you may also use JavaScript expression for the search. Just enter a JavaScript boolean expression&quot;+&quot; into the search field, framed with {{{ { ... } }}}. In the code refer to the variable tiddler and e&quot;+&quot;valuate to {{{true}}} when the given tiddler should be included in the result. \n\nExample: {{{ { tidd&quot;+&quot;ler.modified &gt; new Date(\&quot;Jul 4, 2005\&quot;)} }}} returns all tiddler modified after July 4th, 2005.\n\n!Com&quot;+&quot;bined Search\nYou are free to combine the various search options. \n\n''Examples''\n|!What you type|!Res&quot;+&quot;ult|\n|{{{!jonny !jeremy -%football}}}|all tiddlers with both {{{jonny}}} and {{{jeremy}}} in its tit&quot;+&quot;les, but no {{{football}}} in content.|\n|{{{#=Task}}}|All tiddlers tagged with 'Task' (the exact wor&quot;+&quot;d). Tags named '~CompletedTask', '~TaskForce' etc. are not considered.|\n\n!Access Keys\nYou are encour&quot;+&quot;aged to use the access keys (also called \&quot;shortcut\&quot; keys) for the most frequently used operations. F&quot;+&quot;or quick reference these shortcuts are also mentioned in the tooltip for the various buttons etc.\n\n|&quot;+&quot;!Key|!Operation|\n|{{{Alt-F}}}|''The most important keystroke'': It moves the cursor to the search in&quot;+&quot;put field so you can directly start typing your query. Pressing {{{Alt-F}}} will also display the pr&quot;+&quot;evious search result. This way you can quickly display multiple tiddlers using \&quot;Press {{{Alt-F}}}. S&quot;+&quot;elect tiddler.\&quot; sequences.|\n|{{{ESC}}}|Closes the [[YourSearch Result]]. When the [[YourSearch Resul&quot;+&quot;t]] is already closed and the cursor is in the search input field the field's content is cleared so &quot;+&quot;you start a new query.|\n|{{{Alt-1}}}, {{{Alt-2}}},... |Pressing these keys opens the first, second e&quot;+&quot;tc. tiddler from the result list.|\n|{{{Alt-O}}}|Opens all found tiddlers.|\n|{{{Alt-P}}}|Toggles the &quot;+&quot;'Preview Text' mode.|\n|{{{Alt-'&lt;'}}}, {{{Alt-'&gt;'}}}|Displays the previous or next page in the [[Your&quot;+&quot;Search Result]].|\n|{{{Return}}}|When you have turned off the 'as you type' search mode pressing the &quot;+&quot;{{{Return}}} key actually starts the search (as does pressing the 'search' button).|\n\n//If some of t&quot;+&quot;hese shortcuts don't work for you check your browser if you have other extensions installed that alr&quot;+&quot;eady \&quot;use\&quot; these shortcuts.//&quot;;config.shadowTiddlers[&quot;YourSearch Options&quot;]=&quot;|&gt;|!YourSearch Options|\n|&gt;|&lt;&lt;option chkUseYourSearch&gt;&gt; Use 'Your Search'|\n|!|&lt;&lt;option chkPreviewText&quot;+&quot;&gt;&gt; Show Text Preview|\n|!|&lt;&lt;option chkSearchAsYouType&gt;&gt; 'Search As You Type' Mode (No RETURN required&quot;+&quot; to start search)|\n|!|Default Search Filter:&lt;&lt;option chkSearchInTitle&gt;&gt;Title ('!')     &lt;&lt;option chk&quot;+&quot;SearchInText&gt;&gt;Text ('%')     &lt;&lt;option chkSearchInTags&gt;&gt;Tags ('#')    &lt;&lt;option chkSearchExtendedFiel&quot;+&quot;ds&gt;&gt;Extended Fields&lt;html&gt;&lt;br&gt;&lt;font size=\&quot;-2\&quot;&gt;The fields of a tiddlers that are searched when you don&quot;+&quot;'t explicitly specify a filter in the search text &lt;br&gt;(Explictly specify fields using one or more '!&quot;+&quot;', '%', '#' or 'fieldname:' prefix before the word/text to find).&lt;/font&gt;&lt;/html&gt;|\n|!|Number of items &quot;+&quot;on search result page: &lt;&lt;option txtItemsPerPage&gt;&gt;|\n|!|Number of items on search result page with pre&quot;+&quot;view text: &lt;&lt;option txtItemsPerPageWithPreview&gt;&gt;|\n&quot;;config.shadowTiddlers[&quot;YourSearchStyleSheet&quot;]=&quot;/***\n!~YourSearchResult Stylesheet\n***/\n/*{{{*/\n.yourSearchResult {\n\tposition: absolute;\n\twidth: 800&quot;+&quot;px;\n\n\tpadding: 0.2em;\n\tlist-style: none;\n\tmargin: 0;\n\n\tbackground: #ffd;\n\tborder: 1px solid DarkGra&quot;+&quot;y;\n}\n\n/*}}}*/\n/***\n!!Summary Section\n***/\n/*{{{*/\n.yourSearchResult .summary {\n\tborder-bottom-width:&quot;+&quot; thin;\n\tborder-bottom-style: solid;\n\tborder-bottom-color: #999999;\n\tpadding-bottom: 4px;\n}\n\n.yourSea&quot;+&quot;rchRange, .yourSearchCount, .yourSearchQuery   {\n\tfont-weight: bold;\n}\n\n.yourSearchResult .summary .&quot;+&quot;button {\n\tfont-size: 10px;\n\n\tpadding-left: 0.3em;\n\tpadding-right: 0.3em;\n}\n\n.yourSearchResult .summa&quot;+&quot;ry .chkBoxLabel {\n\tfont-size: 10px;\n\n\tpadding-right: 0.3em;\n}\n\n/*}}}*/\n/***\n!!Items Area\n***/\n/*{{{*&quot;+&quot;/\n.yourSearchResult .marked {\n\tbackground: none;\n\tfont-weight: bold;\n}\n\n.yourSearchItem {\n\tmargin-to&quot;+&quot;p: 2px;\n}\n\n.yourSearchNumber {\n\tcolor: #808080;\n}\n\n\n.yourSearchTags {\n\tcolor: #008000;\n}\n\n.yourSearc&quot;+&quot;hText {\n\tcolor: #808080;\n\tmargin-bottom: 6px;\n}\n\n/*}}}*/\n/***\n!!Footer\n***/\n/*{{{*/\n.yourSearchFoote&quot;+&quot;r {\n\tmargin-top: 8px;\n\tborder-top-width: thin;\n\tborder-top-style: solid;\n\tborder-top-color: #999999;&quot;+&quot;\n}\n\n.yourSearchFooter a:hover{\n\tbackground: none;\n\tcolor: none;\n}\n/*}}}*/\n/***\n!!Navigation Bar\n***/&quot;+&quot;\n/*{{{*/\n.yourSearchNaviBar a {\n\tfont-size: 16px;\n\tmargin-left: 4px;\n\tmargin-right: 4px;\n\tcolor: bla&quot;+&quot;ck;\n\ttext-decoration: underline;\n}\n\n.yourSearchNaviBar a:hover {\n\tbackground-color: none;\n}\n\n.yourSe&quot;+&quot;archNaviBar .prev {\n\tfont-weight: bold;\n\tcolor: blue;\n}\n\n.yourSearchNaviBar .currentPage {\n\tcolor: #&quot;+&quot;FF0000;\n\tfont-weight: bold;\n\ttext-decoration: none;\n}\n\n.yourSearchNaviBar .next {\n\tfont-weight: bold&quot;+&quot;;\n\tcolor: blue;\n}\n/*}}}*/\n&quot;;config.shadowTiddlers[&quot;YourSearchResultTemplate&quot;]=&quot;&lt;!--\n{{{\n--&gt;\n&lt;span macro=\&quot;yourSearch if found\&quot;&gt;\n&lt;!-- The Summary Header ============================&quot;+&quot;================ --&gt;\n&lt;table class=\&quot;summary\&quot; border=\&quot;0\&quot; width=\&quot;100%\&quot; cellspacing=\&quot;0\&quot; cellpadding=\&quot;0\&quot;&gt;&quot;+&quot;&lt;tbody&gt;\n  &lt;tr&gt;\n\t&lt;td align=\&quot;left\&quot;&gt;\n\t\tYourSearch Result &lt;span class=\&quot;yourSearchRange\&quot; macro=\&quot;yourSearc&quot;+&quot;h itemRange\&quot;&gt;&lt;/span&gt;\n\t\t&amp;nbsp;of&amp;nbsp;&lt;span class=\&quot;yourSearchCount\&quot; macro=\&quot;yourSearch count\&quot;&gt;&lt;/span&gt;\n&quot;+&quot;\t\tfor&amp;nbsp;&lt;span class=\&quot;yourSearchQuery\&quot; macro=\&quot;yourSearch query\&quot;&gt;&lt;/span&gt;\n\t&lt;/td&gt;\n\t&lt;td class=\&quot;yourSea&quot;+&quot;rchButtons\&quot; align=\&quot;right\&quot;&gt;\n\t\t&lt;span macro=\&quot;yourSearch chkPreviewText\&quot;&gt;&lt;/span&gt;&lt;span class=\&quot;chkBoxLabel&quot;+&quot;\&quot;&gt;preview text&lt;/span&gt;\n\t\t&lt;span macro=\&quot;yourSearch newTiddlerButton\&quot;&gt;&lt;/span&gt;\n\t\t&lt;span macro=\&quot;yourSearch openAllButton\&quot;&gt;&lt;/span&gt;\n\t\t&lt;span macro=\&quot;yourSearch lin&quot;+&quot;kButton 'YourSearch Options' options 'Configure YourSearch'\&quot;&gt;&lt;/span&gt;\n\t\t&lt;span macro=\&quot;yourSearch linkB&quot;+&quot;utton 'YourSearch Help' help 'Get help how to use YourSearch'\&quot;&gt;&lt;/span&gt;\n\t\t&lt;span macro=\&quot;yourSearch clo&quot;+&quot;seButton\&quot;&gt;&lt;/span&gt;\n\t&lt;/td&gt;\n  &lt;/tr&gt;\n&lt;/tbody&gt;&lt;/table&gt;\n\n&lt;!-- The List of Found Tiddlers =================&quot;+&quot;=========================== --&gt;\n&lt;div id=\&quot;yourSearchResultItems\&quot; itemsPerPage=\&quot;25\&quot; itemsPerPageWithPr&quot;+&quot;eview=\&quot;10\&quot;&gt;&lt;/div&gt;\n\n&lt;!-- The Footer (with the Navigation) ===========================================&quot;+&quot;= --&gt;\n&lt;table class=\&quot;yourSearchFooter\&quot; border=\&quot;0\&quot; width=\&quot;100%\&quot; cellspacing=\&quot;0\&quot; cellpadding=\&quot;0\&quot;&gt;&lt;tbody&quot;+&quot;&gt;\n  &lt;tr&gt;\n\t&lt;td align=\&quot;left\&quot;&gt;\n\t\tResult page: &lt;span class=\&quot;yourSearchNaviBar\&quot; macro=\&quot;yourSearch naviBar&quot;+&quot;\&quot;&gt;&lt;/span&gt;\n\t&lt;/td&gt;\n\t&lt;td align=\&quot;right\&quot;&gt;&lt;span macro=\&quot;yourSearch version\&quot;&gt;&lt;/span&gt;, &lt;span macro=\&quot;yourSearc&quot;+&quot;h copyright\&quot;&gt;&lt;/span&gt;\n\t&lt;/td&gt;\n  &lt;/tr&gt;\n&lt;/tbody&gt;&lt;/table&gt;\n&lt;!-- end of the 'tiddlers found' case =========&quot;+&quot;================================== --&gt;\n&lt;/span&gt;\n\n\n&lt;!-- The \&quot;No tiddlers found\&quot; case =================&quot;+&quot;========================== --&gt;\n&lt;span macro=\&quot;yourSearch if not found\&quot;&gt;\n&lt;table class=\&quot;summary\&quot; border=&quot;+&quot;\&quot;0\&quot; width=\&quot;100%\&quot; cellspacing=\&quot;0\&quot; cellpadding=\&quot;0\&quot;&gt;&lt;tbody&gt;\n  &lt;tr&gt;\n\t&lt;td align=\&quot;left\&quot;&gt;\n\t\tYourSearch Resu&quot;+&quot;lt: No tiddlers found for &lt;span class=\&quot;yourSearchQuery\&quot; macro=\&quot;yourSearch query\&quot;&gt;&lt;/span&gt;.\n\t&lt;/td&gt;\n\t&lt;t&quot;+&quot;d class=\&quot;yourSearchButtons\&quot; align=\&quot;right\&quot;&gt;\n\t\t&lt;span macro=\&quot;yourSearch newTiddlerButton\&quot;&gt;&lt;/span&gt;\n\t\t&lt;span macro=\&quot;yourSearch linkButton 'YourSearch Options'&quot;+&quot; options 'Configure YourSearch'\&quot;&gt;&lt;/span&gt;\n\t\t&lt;span macro=\&quot;yourSearch linkButton 'YourSearch Help' help&quot;+&quot; 'Get help how to use YourSearch'\&quot;&gt;&lt;/span&gt;\n\t\t&lt;span macro=\&quot;yourSearch closeButton\&quot;&gt;&lt;/span&gt;\n\t&lt;/td&gt;\n  &lt;&quot;+&quot;/tr&gt;\n&lt;/tbody&gt;&lt;/table&gt;\n&lt;/span&gt;\n\n\n&lt;!--\n}}}\n--&gt;\n&quot;;config.shadowTiddlers[&quot;YourSearchItemTemplate&quot;]=&quot;&lt;!--\n{{{\n--&gt;\n&lt;span class='yourSearchNumber' macro='foundTiddler number'&gt;&lt;/span&gt;\n&lt;span class='yourSea&quot;+&quot;rchTitle' macro='foundTiddler title'/&gt;&lt;/span&gt;&amp;nbsp;-&amp;nbsp;\n&lt;span class='yourSearchTags' macro='found&quot;+&quot;Tiddler field tags 50'/&gt;&lt;/span&gt;\n&lt;span macro=\&quot;yourSearch if previewText\&quot;&gt;&lt;div class='yourSearchText' macro='fo&quot;+&quot;undTiddler field text 250'/&gt;&lt;/div&gt;&lt;/span&gt;\n&lt;!--\n}}}\n--&gt;&quot;;config.shadowTiddlers[&quot;YourSearch&quot;]=&quot;&lt;&lt;tiddler [[YourSearch Help]]&gt;&gt;&quot;;config.shadowTiddlers[&quot;YourSearch Result&quot;]=&quot;The popup-like window displaying the result of a YourSearch query.&quot;;config.macros.search.handler=_109;var _195=function(){if(config.macros.search.handler!=_109){alert(&quot;Message from YourSearchPlugin:\n\n\nAnother plugin has disabled the 'Your Search' features.\n\n\nYou may &quot;+&quot;disable the other plugin or change the load order of \nthe plugins (by changing the names of the tidd&quot;+&quot;lers)\nto enable the 'Your Search' features.&quot;);}};setTimeout(_195,5000);abego.YourSearch.getStandardRankFunction=function(){return _bb;};abego.YourSearch.getRankFunction=function(){return abego.YourSearch.getStandardRankFunction();};abego.YourSearch.getCurrentTiddler=function(){return _f4;};abego.YourSearch.closeResult=function(){_e3();};abego.YourSearch.getFoundTiddlers=function(){return _b1;};abego.YourSearch.getQuery=function(){return _b2;};abego.YourSearch.onShowResult=function(_196){highlightHack=_b2?_b2.getMarkRegExp():null;if(!_196){_f5.setItems(_b5());}if(!_dd){_dd=createTiddlyElement(document.body,&quot;div&quot;,_da,&quot;yourSearchResult&quot;);}else{if(_dd.parentNode!=document.body){document.body.appendChild(_dd);}}_fe();highlightHack=null;};})();}
//%/</pre>
</div>
<div title="elnbPackage - 01 CoreConn" modifier="escdie" created="201102060604" modified="201102181713" tags="%tw-elnb systemConfig %TBD">
<pre>//{{{

// ---
// Information
// ---

if( !version.extensions.elnb )
     version.extensions.elnb = {};

version.extensions.elnb.elnbCore = { major: 1, minor: 0, revision: 0, date: new Date(2011,2,6) };

// ---
// Functions and data
// ---

if( !config.extensions.elnb )
     config.extensions.elnb = {};

config.extensions.elnb.elnbCore = {

     serverType: &quot;file&quot;,
     serverHost: &quot;file:///Y:/work/dwm/elnb/sandbox/tw-elnb_core.html&quot;,
     corePath: &quot;tw-elnb/base/tw-elnb_core.html&quot;,
     coreHost: &quot;&quot;,

    setup: function () {
          
          var fileURL = document.location.toString();       
          fileURL = fileURL.substr( 0,fileURL.lastIndexOf(&quot;/&quot;) );
   
          var coreURL = fileURL + &quot;/&quot; + this.corePath;
          this.coreHost = coreURL;
    } 
};

// ---
// Initialize
// ---

config.extensions.elnb.elnbCore.setup();

//}}}
</pre>
</div>
<div title="elnbPackage - AllTags Macro" modifier="escdie" created="201011091959" modified="201011092207" tags="plugin %tw-elnb systemConfig elnbPackage">
<pre>/***
|Name|elnbAllTags Macro|
|Description||
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on| |
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|Hack|
***/

//{{{
config.macros.elnbAllTags = {
   handler: function(place,macroName,params)
   {
	var tags = store.getTags(params[0]);
	var ul = createTiddlyElement(place,&quot;ul&quot;);
	if(tags.length == 0)
		createTiddlyElement(ul,&quot;li&quot;,null,&quot;listTitle&quot;,this.noTags);
	
        for(var t=0; t&lt;tags.length; t++) 
        {
		var title = tags[t][0];
		var info = getTiddlyLinkInfo(title);
		var li = createTiddlyElement(ul,&quot;li&quot;);
		var btn = createTiddlyButton(li,title + &quot; (&quot; + tags[t][1] + &quot;)&quot;,this.tooltip.format([title]),elnbOnClickTag,info.classes);
		btn.setAttribute(&quot;tag&quot;,title);
		btn.setAttribute(&quot;refresh&quot;,&quot;link&quot;);
		btn.setAttribute(&quot;tiddlyLink&quot;,title);
		if(params[1]) 
                {
			btn.setAttribute(&quot;sortby&quot;,params[1]);
		}
	}
   },  
      
   oldHandler : null,  
};  

config.macros.elnbAllTags.oldHandler = config.macros.allTags.handler;  
config.macros.allTags.handler = config.macros.elnbAllTags.handler;  
//}}}</pre>
</div>
<div title="elnbPackage - CategoryTemplate Plugin" modifier="escdie" created="201009181240" modified="201011181941" tags="plugin pluginInfo systemConfig elnbPackage %tw-elnb">
<pre>/***
|Name|CategoryTemplatePlugin|
|Version|1.0.1|
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|License| |
|Type|Plugin|
|Description|Use alternative ViewTemplate/EditTemplate based on category field of a tiddler|
This plugin extends the core function, story.chooseTemplateForTiddler(), so that any given tiddler can be viewed and/or edited using alternatives to the standard tiddler templates.
!!!!!Configuration
&gt;see [[CategoryTemplatePluginConfig]]
!!!!!Revisions
&gt; 2010.08.25 [1.0.1] initial release 
!!!!!Code
***/
//{{{

version.extensions.CategoryTemplatePlugin = {major: 1, minor: 0, revision: 1, date: new Date(2010,8,25)};

/* */
if ( !config.options.CategoryTemplatePlugin )	
      config.options.CategoryTemplatePlugin = {};

      config.options.CategoryTemplatePlugin.txtFieldname = 'category';
      config.options.CategoryTemplatePlugin.Templates = {};

/* */
Story.prototype.categoryTemplate_chooseTemplateForTiddler = Story.prototype.chooseTemplateForTiddler
Story.prototype.chooseTemplateForTiddler = function( title,template )
{
      // get core template and split into theme and template name
      var coreTemplate = this.categoryTemplate_chooseTemplateForTiddler.apply(this,arguments);
      var theme = &quot;&quot;; 
      var template = coreTemplate;
      var parts = template.split(config.textPrimitives.sectionSeparator);

      if (parts[1]) 
       { 
         theme=parts[0]; 
         template=parts[1]; 
       }
       // if theme is not specified
      else 
      {
         theme = config.options.txtTheme||&quot;&quot;; 
      }

      theme += config.textPrimitives.sectionSeparator;

      // look for templates using category field value as prefix
      var category = store.getValue( title,config.options.CategoryTemplatePlugin.txtFieldname );
      var v = config.options.CategoryTemplatePlugin.Templates[ category ];

      
      // if category is not defined we use the 'template' field
      if ( ( typeof v == &quot;undefined&quot;)  || (v ==&quot;&quot;) ) 
      {
         v = store.getValue( title,&quot;template&quot; );
      }

      // theme##valueTemplate
      if ( store.getTiddlerText( theme + v + template ) )
      { 
            return theme + v + template; 
      }
      // valueTemplate
      if ( store.getTiddlerText( v + template ) )
      { 
            return v + template; 
      }		

      // no match... use core result
      return coreTemplate;
}

//}}}</pre>
</div>
<div title="elnbPackage - CategoryTemplate PluginConfig" modifier="escdie" created="201008301638" modified="201011181941" tags="pluginConfig systemConfig %tw-elnb">
<pre>//{{{

/* Create variables */
config.options.CategoryTemplatePlugin = {};
var categoryTemplates = {}

/* Define keyword used for category */
keyword = 'category';

/* And set a template for each category */
categoryTemplates['journal'] = 'JournalPage';
categoryTemplates['task'] = 'Task';
categoryTemplates['question'] = 'Question';
categoryTemplates['meeting'] = 'Meeting';
categoryTemplates['note'] = 'Note';
categoryTemplates['drawer'] = '';

/* Assign keyword and templates to plugin configuration*/
config.options.CategoryTemplatePlugin.txtFieldname = keyword;
config.options.CategoryTemplatePlugin.Templates = categoryTemplates;

//}}}</pre>
</div>
<div title="elnbPackage - CopyLink ToolbarCmd" modifier="escdie" created="201101190805" modified="201101310854" tags="plugin %tw-elnb systemConfig elnbPackage">
<pre>/***
|Name||
|Description||
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on|TW References Command|
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|ToolbarCommand|
***/

//{{{
if( !config.commands.elnb )     
     config.commands.elnb = {};  

config.commands.elnb.CopyLink = {

    text: &quot;link&quot;,
    tooltip: &quot;Create tiddler link&quot;,
    readOnlyText: &quot;Create tiddler link&quot;,
	
    clipboardSwf : './tools/clipboard.swf',
    flashCopier: {},
    
    handler: function(event,src,title) 
    {
        clearMessage();

        var subject = store.getTiddlerSubjectByTitle( title );
        var linkTiddler = &quot;[[&quot; + subject + &quot;|&quot; + title + &quot;]]&quot;;

        displayMessage( linkTiddler + &quot; link&quot;); 

        thisMacro = config.commands.elnb.CopyLink;

        // Internet Explorer
        if( window.clipboardData )
	{
            window.clipboardData.setData( 'text', linkTiddler );
	}
        // Mozilla
        else if( window.Components ) 
        {
           try { netscape.security.PrivilegeManager.enablePrivilege(&quot;UniversalXPConnect&quot;); }
           catch(e) 
           { 
              alert(e.description?e.description:e.toString()); 
              return; 
           }
           var nsIClipboardHelper = window.Components.interfaces.nsIClipboardHelper;
           const clip = Components.classes[&quot;@mozilla.org/widget/clipboardhelper;1&quot;].getService(nsIClipboardHelper);

           clip.copyString( linkTiddler );
        }
        // Other browsers
	else if( thisMacro.clipboardSwf != null )
	{
	   var flashcopier = thisMacro.flashCopier;
				
	   if( flashcopier == null )
           {
    	                flashcopier = document.createElement('div');
			thisMacro.flashCopier = flashcopier;
			thisMacro.div.appendChild( flashcopier );		
	   }

           flashcopier.innerHTML = '&lt;embed src=&quot;' + thisMacro.clipboardSwf + '&quot; FlashVars=&quot;clipboard=' + 
                                                encodeURIComponent( linkTiddler ) + '&quot; width=&quot;0&quot; height=&quot;0&quot; type=&quot;application/x-shockwave-flash&quot;&gt;&lt;/embed&gt;';
      } 

      displayMessage('The link is in your clipboard now');
   }
};

//	
config.commands.elnbCopyLink  = config.commands.elnb.CopyLink;

//}}}</pre>
</div>
<div title="elnbPackage - ExportData Plugin" modifier="dger" created="201102060521" modified="201102060947" tags="%tw-elnb systemConfig %TBD">
<pre>/***
***/
//{{{

if( !version.extensions.elnb)
       version.extensions.elnb = {};

version.extensions.elnb.elnbExport = {major: 1, minor: 0, revision: 0, date: new Date(2011,2,6)};  

if( !config.extensions.elnb)
       config.extensions.elnb = {};

config.extensions.elnb.ExportData  = {
    filterUserData: &quot;(not %tw-elnb)&quot;,
    filterLayout: &quot;(%tw-elnb)&quot;
};

//--
// Backstage tasks
//-- 

config.tasks.elnbExport = {  
    text: &quot;elnbExport&quot;, 
    tooltip: &quot;Sync to tw-elnb&quot;, 
    content: '&lt;&lt;saveAs &quot;label:Export user data&quot; quiet (not %tw-elnb)&gt;&gt;&lt;br&gt;&lt;&lt;saveAs &quot;label:Export layout&quot; quiet (%tw-elnb)&gt;&gt;'
}  
   
config.backstageTasks.push( &quot;elnbExport&quot; );  

//}}}</pre>
</div>
<div title="elnbPackage - GetTiddlerSubject Plugin" modifier="escdie" created="201011070932" modified="201011110603" tags="systemConfig %tw-elnb elnbPackage %extension">
<pre>/***
|Name|elnbGeTiddlerSubject|
|Description|Returns the 'subject' field of a tiddler, if it does not exist then returns the 'title'. &lt;br&gt;The function is added to TW 'store'.|
|Package|TW-eLNB |
|Version|1.0.0|
|Source||
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|License||
|~CoreVersion||
|Type|Plugin|

!Usage
!!Example 1
Code:
{{{
&lt;&lt;forEachTiddler
      where 'tiddler.tags.contains(&quot;@timeLog&quot;) || 
                tiddler.tags.contains(&quot;@pomodoro&quot;)'  
      sortBy 'tiddler.title' descending
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;

}}}
Output:
&lt;&lt;forEachTiddler
      where 'tiddler.tags.contains(&quot;@timeLog&quot;) || 
                tiddler.tags.contains(&quot;@pomodoro&quot;)'  
      sortBy 'tiddler.title' descending
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
!!Example 2
Code:
{{{
store.getTiddlerSubjectByTitle(&quot;Dashboard&quot;)
store.getTiddlerSubjectByTitle(&quot;MM-20101029-1&quot;)
}}}
Output
 
!Source code
***/
//{{{

Tiddler.prototype.getSubject = function()
{
        var text = &quot;&quot;;

        var subject = undefined;
        var fieldName = &quot;subject&quot;;

        subject = this.fields[fieldName];

        if( subject == undefined )
           text = tiddler['title'];
        else 
           text = subject;

	return text;
};


TiddlyWiki.prototype.getTiddlerSubject = function (tiddler)
{
        var text = &quot;&quot;;

        var subject = undefined;
        var fieldName = &quot;subject&quot;;

        subject = this.getValue( tiddler,fieldName );

        if( subject == undefined )
           text = tiddler['title'];
        else 
           text = subject;

	return text;
};

TiddlyWiki.prototype.getTiddlerSubjectByTitle = function (title)
{
        var tiddler = undefined;
        var text = &quot;&quot;;

        // Find tiddler by title
        tiddler = this.getTiddler( title );
        if( tiddler == undefined)
           return title; 
        
        // Get subject from tiddler
        var subject = undefined;
        var fieldName = &quot;subject&quot;;

        subject = this.getValue( tiddler,fieldName );

        // Return subject if exists or return titlle
        if( subject == undefined )
           text = title;
        else 
           text = subject;

	return text;
};

TiddlyWiki.prototype.existTiddlerSubject = function (tiddler)
{
        var ret;

        var subject = undefined;
        var fieldName = &quot;subject&quot;;

        subject = this.getValue( tiddler,fieldName );

        if( subject == undefined )
           ret = false;
        else 
           ret = true;

	return ret;
};
//}}}</pre>
</div>
<div title="elnbPackage -  Jump Command" modifier="escdie" created="201011110551" modified="201011110554" tags="plugin %tw-elnb systemConfig elnbPackage">
<pre>/***
|Name|Jump Command|
|Description||
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on|TW Jump Command|
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|Hack|
***/

//{{{
config.commands.elnbJump = {
   
   handlePopup :  function(popup,title)
   {  
        story.forEachTiddler(function(title,element) {
                 elnbCreateTiddlyLink(createTiddlyElement(popup,&quot;li&quot;),title,true,null,false,null,true);
        });
    },
    
    oldHandlePopup  : null,
};

config.commands.elnbJump.oldHandlePopup  = config.commands.jump.handlePopup ;
config.commands.jump.handlePopup = config.commands.elnbJump.handlePopup ;

//}}}
</pre>
</div>
<div title="elnbPackage - LastUpdates Macro" modifier="escdie" created="201102081732" modified="" tags="%tw-elnb systemConfig plugin">
<pre>//{{{

if ( !config.macros.elnb ) 
        config.macros.elnb = {};

config.macros.elnb.lastUpdates = {

dateFormat: &quot;DD MMM YYYY&quot;,

searchValue: &quot;%tw-elnb&quot;,
searchMatch: false,

handler : function(place,macroName,params)
{
	var field = params[0] || &quot;modified&quot;;
	var tiddlers = store.reverseLookup(&quot;tags&quot;,this.searchValue,this.searchMatch,field);
	//var tiddlers = store.reverseLookup(&quot;tags&quot;,&quot;excludeLists&quot;,false,field);
	var lastDay = &quot;&quot;;
	var last = params[1] ? tiddlers.length-Math.min(tiddlers.length,parseInt(params[1])) : 0;
	var dateFormat = params[2] || this.dateFormat;
	
        for(var t=tiddlers.length-1; t&gt;=last; t--) 
        {
		var tiddler = tiddlers[t];
		var theDay = tiddler[field].convertToLocalYYYYMMDDHHMM().substr(0,8);
		if(theDay != lastDay) {
			var ul = document.createElement(&quot;ul&quot;);
			addClass(ul,&quot;timeline&quot;);
			place.appendChild(ul);
			createTiddlyElement(ul,&quot;li&quot;,null,&quot;listTitle&quot;,tiddler[field].formatString(dateFormat));
			lastDay = theDay;
		}
		createTiddlyElement(ul,&quot;li&quot;,null,&quot;listLink&quot;).appendChild(elnbCreateTiddlyLink(place,tiddler.title,true));
	}
}   

};    

config.macros.elnbLastUpdates = config.macros.elnb.lastUpdates ;

//}}}</pre>
</div>
<div title="elnbPackage - List Macro" modifier="escdie" created="201011061439" modified="201011092209" tags="plugin %tw-elnb systemConfig elnbPackage">
<pre>/***
|Name|elnbList Macro|
|Description||
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on| |
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|Hack|
***/

//{{{
config.macros.elnbList = {
   
   handler :  function(place,macroName,params)
   {  
        var type = params[0] || &quot;all&quot;;
        var list = document.createElement(&quot;ul&quot;);
        place.appendChild(list);
     
        if(this[type].prompt)
            createTiddlyElement(list,&quot;li&quot;,null,&quot;listTitle&quot;,this[type].prompt);
        
        var results;	
        if(this[type].handler)
            results = this[type].handler(params);
        
        for(var t = 0; t &lt; results.length; t++) 
        {
            var li = document.createElement(&quot;li&quot;);
            list.appendChild(li);
            
            //createTiddlyLink(li,typeof results[t] == &quot;string&quot; ? results[t] : results[t].title,true);	
            elnbCreateTiddlyLink(li,typeof results[t] == &quot;string&quot; ? results[t] : results[t].title,true);	
        }
    },
    
    oldHandler : null,
};

config.macros.elnbList.oldHandler = config.macros.list.handler;
config.macros.list.handler = config.macros.elnbList.handler;

//}}}
</pre>
</div>
<div title="elnbPackage - NewActivityCmd" modifier="escdie" created="201101131645" modified="201101171011" tags="%tw-elnb systemConfig">
<pre>/***
|Name|NewActivityCmd Plugin|
|Package|tw-elnb|
|Description||
|Version|1.0.0|
|Requires||
|Based on|[[AttachFilePlugin|http://www.TiddlyTools.com/#AttachFilePlugin]]|
|Source||
|Author|dieesrod@[[zyzlab|http://zyzlab.dyndns.org]]|
|License||
|Type|plugin|

!!!!!Revisions
&lt;&lt;&lt;
201101.15 [1.0.0] Initial Release
&lt;&lt;&lt;
!!!!!Code
***/
// // version
//{{{
if( !version.extensions.elnb )   
    version.extensions.elnb = {};
    
version.extensions.elnb.NewCmdPlugin = {major: 1, minor: 0, revision: 0, date: new Date(2011,1,5)};

//}}}
//{{{
config.macros.elnbNewActivity = {

    // ---------------------------------------
    // attributes
    // ---------------------------------------

	label: &quot;new activity&quot;,
	tooltip: &quot;Create a new activity&quot;,
	linkTooltip: &quot;Activity: &quot;,
    
    tagPrefix: '$',
    tags: &quot;@activity&quot;,

	titlePrompt: &quot;&quot;,
    tagPrompt: &quot;&quot;,
	tiddlerErr: &quot;Please enter name&quot;,
	tagErr: &quot;Please enter only 1 tag&quot;,
	tiddlerFormat: '&lt;&lt;list filter \&quot;[tag[%0]]\&quot;&gt;&gt;\n&lt;&lt;autoRefresh&gt;&gt;\n',

    // ---------------------------------------
    // macro handle
    // ---------------------------------------


	handler:
	function(place,macroName,params) 
    {
		if (params &amp;&amp; !params[0])
			{ createTiddlyButton(place,this.label,this.tooltip,this.toggleActivityPanel); return; }
		var id=params.shift();
		this.createActivityPanel(place,id+&quot;_activityPanel&quot;,params);
		document.getElementById(id+&quot;_activityPanel&quot;).style.position=&quot;static&quot;;
		document.getElementById(id+&quot;_activityPanel&quot;).style.display=&quot;block&quot;;
	},
    
    // ---------------------------------------
    // interface definition
    // ---------------------------------------

	css:
	&quot;.activityPanel { display: none; position:absolute; z-index:10; width:35em; right:105%; top:0em;\
		background-color: #eee; color:#000; font-size: 8pt; line-height:110%;\
		border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;\
		padding: 0.5em; margin:0em; -moz-border-radius:1em;-webkit-border-radius:1em; text-align:left }\
	.activityPanel form { display:inline;border:0;padding:0;margin:0; }\
	.activityPanel select { width:99%;margin:0px;font-size:8pt;line-height:110%;}\
	.activityPanel input  { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\
	.activityPanel textarea { width:98%;margin:0px;height:2em;font-size:8pt;line-height:110%}\
	.activityPanel table { width:100%;border:0;margin:0;padding:0;color:inherit; }\
	.activityPanel tbody, .activityPanel tr, .activityPanel td { border:0;margin:0;padding:0;color:#000; }\
	.activityPanel .box { border:1px solid black; padding:.3em; margin:.3em 0px; background:#f8f8f8; \
		-moz-border-radius:5px;-webkit-border-radius:5px; }\
	.activityPanel .chk { width:auto;border:0; }\
	.activityPanel .btn { width:auto; }\
	.activityPanel .btn2 { width:49%; }\
	&quot;,

	html:
	'&lt;form&gt;\
		Create activity\
		&lt;table style=&quot;border:0&quot;&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			Name&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot; colspan=2&gt;\
			&lt;input type=text name=&quot;tiddlertitle&quot; size=15 autocomplete=off value=&quot;%title%&quot;\
				onkeyup=&quot;if (!this.value.length) { this.value=config.macros.elnbNewActivity.titlePrompt; this.select(); }&quot;\
				onfocus=&quot;if (!this.value.length) this.value=config.macros.elnbNewActivity.titlePrompt; this.select()&quot; %disabled%&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			Tag&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot;&gt;\
			&lt;input type=text name=&quot;tags&quot; size=15 autocomplete=off value=&quot;&quot; onfocus=&quot;this.select()&quot;&gt;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot;&gt;&lt;/td&gt;&lt;/tr&gt;\
        &lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0&quot;&gt;&lt;/td&gt;\
            &lt;td style=&quot;width:40%;text-align:right;border:0&quot;&gt;\
			&lt;input type=button class=btn2 value=&quot;add&quot;\
				onclick=&quot;config.macros.elnbNewActivity.onClickAdd(this)&quot;&gt;\
            &lt;/td&gt;&lt;td style=&quot;width:40%;text-align:left;border:0&quot;&gt;\
            &lt;input type=button class=btn2 value=&quot;close&quot;\
				onclick=&quot;var panel=document.getElementById(\'%id%\'); if (panel) panel.parentNode.removeChild(panel);&quot;&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;\
        An activity is composed by a name and a tag. &lt;br&gt;\
        The tag must be only 1 word and it is used to link several tiddlers to the activity. And\
        prefix %tagPrefix% will be automatically added to the tag you input.\
	&lt;/form&gt;',

	html_bak:
	'&lt;form&gt;\
		Create activity\
		&lt;table style=&quot;border:0&quot;&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			Name&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot; colspan=2&gt;\
			&lt;input type=text name=&quot;tiddlertitle&quot; size=15 autocomplete=off value=&quot;%title%&quot;\
				onkeyup=&quot;if (!this.value.length) { this.value=config.macros.elnbNewActivity.titlePrompt; this.select(); }&quot;\
				onfocus=&quot;if (!this.value.length) this.value=config.macros.elnbNewActivity.titlePrompt; this.select()&quot; %disabled%&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;border:0&quot;&gt;&lt;td style=&quot;border:0;text-align:right;width:1%;white-space:nowrap&quot;&gt;\
			Tag&amp;nbsp;\
		&lt;/td&gt;&lt;td style=&quot;border:0&quot;&gt;\
			&lt;input type=text name=&quot;tags&quot; size=15 autocomplete=off value=&quot;&quot; onfocus=&quot;this.select()&quot;&gt;\
		&lt;/td&gt;&lt;td style=&quot;width:40%;text-align:right;border:0&quot;&gt;\
			&lt;input type=button class=btn2 value=&quot;add&quot;\
				onclick=&quot;config.macros.elnbNewActivity.onClickAdd(this)&quot;&gt;&lt;!--\
			--&gt;&lt;input type=button class=btn2 value=&quot;close&quot;\
				onclick=&quot;var panel=document.getElementById(\'%id%\'); if (panel) panel.parentNode.removeChild(panel);&quot;&gt;\
		&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;\
        An activity is composed by a name and a tag &lt;br&gt;\
        The tag must start by $ and it is used to link several tiddlers to the activity.\
	&lt;/form&gt;',
    
    // ---------------------------------------
    // functions
    // ---------------------------------------

	createActivityPanel:
	function(place,panel_id,params) 
    {
		if (!panel_id || !panel_id.length) var panel_id=&quot;_attachPanel&quot;;
            
		// remove existing panel (if any)
		var panel=document.getElementById(panel_id); if (panel) panel.parentNode.removeChild(panel);
		
        // set styles for this panel
		setStylesheet(this.css,&quot;activityPanel&quot;);
		
        // create new panel
		var title=&quot;&quot;; if (params &amp;&amp; params[0]) title=params.shift();
		
 		panel=createTiddlyElement(place,&quot;span&quot;,panel_id,&quot;activityPanel&quot;,null);

		var html=this.html.replace(/%id%/g,panel_id);
		html=html.replace(/%title%/g,title);
		html=html.replace(/%disabled%/g,title.length?&quot;disabled&quot;:&quot;&quot;);
		html=html.replace(/%IEdisabled%/g,config.browser.isIE?&quot;disabled&quot;:&quot;&quot;);

        html=html.replace(/%tagPrefix%/g,this.tagPrefix);
        
		panel.innerHTML=html;
		if (config.browser.isGecko) { // FF3 FIXUP
			document.getElementById(&quot;attachSource&quot;).style.display=&quot;none&quot;;
			document.getElementById(&quot;attachFixPanel&quot;).style.display=&quot;block&quot;;
		}
		return panel;
	},

	toggleActivityPanel: 
    function (e) 
    {
		if (!e) var e = window.event;
		var parent=resolveTarget(e).parentNode;
		var panel = document.getElementById(&quot;_activityPanel&quot;);
		if (panel==undefined || panel.parentNode!=parent)
			panel=config.macros.elnbNewActivity.createActivityPanel(parent,&quot;_activityPanel&quot;);
		var isOpen = panel.style.display==&quot;block&quot;;
		if(config.options.chkAnimate)
			anim.startAnimating(new Slider(panel,!isOpen,e.shiftKey || e.altKey,&quot;none&quot;));
		else
			panel.style.display = isOpen ? &quot;none&quot; : &quot;block&quot; ;
		e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
		return(false);
	},

	onClickAdd:	
    function (here) 
    {
		clearMessage();
        
		// get input values
		var form = here.form;
		var when = (new Date()).formatString(config.macros.timeline.dateFormat);
		var title = form.tiddlertitle.value;
		var tags = this.tags;
        var tagName = form.tags.value;
	
		// validate activity title
		if (!title || !title.trim().length || title==this.titlePrompt)
			{ form.tiddlertitle.focus(); alert(this.tiddlerErr); return false; }
		// validate activity tag
		if (!tagName || !tagName.trim().length || tagName==this.tagPrompt)
			{ form.tags.focus(); alert(this.tagErr); return false; }		       
		// create activity tiddler
		return this.createActivityTiddler( title,tagName,tags );
	},
    
	createActivityTiddler: 
    function (title, tagName, tags) 
    {		
		var theText = this.tiddlerFormat.format([ this.tagPrefix +	tagName]);        
        store.saveTiddler( title,title,theText,config.options.txtUserName,new Date(),tags );
		
        var panel=document.getElementById(&quot;activityPanel&quot;); 
        if (panel) panel.style.display=&quot;none&quot;;
		
        if (!noshow) 
        { 
            story.displayTiddler(null,title); 
            story.refreshTiddler(title,null,true); 
        }
        
		displayMessage('New activity &quot;'+title+'&quot;');
		return true;
	}
};
//}}}
//{{{
if (window.mozAskForFilename===undefined) { // also defined by CoreTweaks (for ticket #604)
	window.mozAskForFilename=function(msg,path,file,mustExist) {
		if(!window.Components) return false;
		try {
			netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
			var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
			var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
			picker.init(window, msg, mustExist?nsIFilePicker.modeOpen:nsIFilePicker.modeSave);
			var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
			thispath.initWithPath(path);
			picker.displayDirectory=thispath;
			picker.defaultExtension='';
			picker.defaultString=file;
			picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
			if (picker.show()!=nsIFilePicker.returnCancel)
				var result=picker.file.persistentDescriptor;
		}
		catch(ex) { displayMessage(ex.toString()); }
		return result;
	}
}
//}}}</pre>
</div>
<div title="elnbPackage - NewCmds Plugin" modifier="dger" created="201010201911" modified="201212121633" tags="%tw-elnb systemConfig %extension elnbPackage plugin">
<pre>/***
|''Name:''|elnbNewCmdPlugin|
|''Description:''||
|''Version:''|1.1.1|
|''Date:''|Oct 24,2010|
|''Source:''| |
|''Author:''|dieesrod@[[zyzlab|http://zyzlab.dyndns.org]]|
|''License:''|[[BSD open source license|License]]|

Examples: &lt;&lt;elnbNewJournal&gt;&gt;&lt;&lt;elnbTodayJournal&gt;&gt;&lt;&lt;elnbTodayJournal2&gt;&gt;&lt;&lt;elnbNewNote&gt;&gt;&lt;&lt;elnbNewTodo&gt;&gt;&lt;&lt;elnbNewQuestion&gt;&gt;&lt;&lt;elnbNewMeeting&gt;&gt;&lt;&lt;elnbNewReference&gt;&gt;

''General''
***/
//{{{
if( !version.extensions.elnb )   
    version.extensions.elnb = {};
    
version.extensions.elnb.NewCmdPlugin= { major: 4, minor: 0, revision: 0, date: new Date(2009,6,4) };  

version.extensions.elnb = 
{
     newTID: function() 
     {           
        // Today date
         var today = new Date().formatString( 'YYYY0MM0DD' );

         // Extract TID from tiddler and divide it in date and id
         var tiddler = store.getTiddler( &quot;TID&quot;);
         var text = tiddler[&quot;text&quot;];

         var token = text.split(&quot;-&quot;)
         var prevDate= token[0];
         var id = parseInt( token[1] );
       
         // If TID is smaller than current date then update TID completly
         // else increment only id.

         if( today &gt; prevDate )
         {
           var newDate = today ;
           var newId = 1;
         }
         else 
         {
           var newDate = prevDate;
           var newId = id + 1;
         }

         // Create TID using date and id
         // Store it in a tiddler and return the value

         var tid = newDate  + '-' +  newId ;
         tiddler[&quot;text&quot;] = tid;
         
         return tid;     
     } ,
};

//}}}
/***
''New note''
***/
//{{{
config.macros.elnbNewNote = {  

     label: &quot;new note&quot;,  
     tooltip: &quot;Create a new note&quot;,  
     category: &quot;note&quot;,
     tags: &quot;&quot;,

     handler: function ( place,macroName,params,wikifier,paramString,tiddler ) 
     {  
         var buttonLabel = this.label;  
         var buttonTip  = this.tooltip;  

         createTiddlyButton( place,buttonLabel,buttonTip,this.createNote );  
     },

     createNote: function(e) 
     {            
         var date = new Date();
         var author = config.options.txtUserName;

         var tid = version.extensions.elnb.newTID();
         var title = &quot;NO-&quot; + tid;
         subject = &quot;New note ...&quot;;
         var text = &quot;&quot;;

         var category =  config.macros.elnbNewNote.category;
         var tags = config.macros.elnbNewNote.tags;    

         store.saveTiddler( title,title,text,author,date,tags );
         store.setValue( title,&quot;category&quot;,category );        
         store.setValue( title,&quot;subject&quot;,subject );    

         story.displayTiddler(null, title, DEFAULT_EDIT_TEMPLATE);
     } ,
}
//}}}
/***
''New journal''
***/
//{{{
config.macros.elnbNewJournal = {  

     label: &quot;new journal&quot;,  
     tooltip: &quot;Create a new journal entry&quot;,  
     category: &quot;journal&quot;,
     tags: &quot;#starred&quot;,

     page1_suffix: &quot;Diary&quot;,
     page1_tags: &quot;@diary&quot;,
     page1_default: &quot;&quot;,

     page2_suffix: &quot;TimeLog&quot;,
     page2_tags: &quot;@timeLog&quot;,
     page2_default: &quot;TimeLogDefaultData&quot;,

     page3_suffix: &quot;Pomodoro&quot;,
     page3_tags: &quot;@pomodoro&quot;,
     page3_default: &quot;PomodoroDefaultData&quot;,

     handler: function ( place,macroName,params,wikifier,paramString,tiddler ) 
     {  
         var buttonLabel = this.label;  
         var buttonTip  = this.tooltip;  

         createTiddlyButton( place,buttonLabel,buttonTip,this.createJournal );  
     },

     createJournal : function(e) 
     {  
         var date = new Date();
         var author = config.options.txtUserName;
         var title = &quot;JRL &quot;+ date.formatString( 'YYYY-0MM-0DD ddd' );
         var category =  config.macros.elnbNewJournal.category;
         
         var text = &quot;&quot;;
         var tags;
         var defaultData;
       
         // Page
         // ----------------------------------------------------------------------------------

         var mainTitle = title;
         tags = config.macros.elnbNewJournal.tags;
         
         text = &quot;&quot;;         
         store.saveTiddler( mainTitle,mainTitle,text,author,date,tags );
         store.setValue( mainTitle ,&quot;category&quot;,category );

         story.displayTiddler( null,mainTitle,DEFAULT_VIEW_TEMPLATE );
     } ,
}
//}}}
/***
''Today journal''
***/
//{{{
config.macros.elnbTodayJournal = {  

     label: &quot;today journal&quot;,  
     tooltip: &quot;Open today journal entry&quot;,  

     handler: function ( place,macroName,params,wikifier,paramString,tiddler ) 
     {  
         var date = new Date();
         var title = &quot;JRL &quot;+ date.formatString( 'YYYY-0MM-0DD ddd' );
         //createTiddlyLink(place,title,includeText,className,isStatic,linkedFromTiddler,noToggle)
         //createTiddlyLink(createTiddlyElement(popup,&quot;li&quot;),title,true,null,false,null,true);  
         createTiddlyLink( place,title,true,null,false,null,true );  
     },
}
//}}}
/***
''Today journal''
***/
//{{{
config.macros.elnbTodayJournal2 = {  

     label: &quot;today journal&quot;,  
     tooltip: &quot;Open today journal entry&quot;,  

     handler: function ( place,macroName,params,wikifier,paramString,tiddler ) 
     {  
         var buttonLabel = this.label;  
         var buttonTip  = this.tooltip;  

        var date = new Date();
        buttonLabel = date.formatString( 'YYYY-0MM-0DD ddd' );

        createTiddlyButton( place,buttonLabel,buttonTip,this.openTodayJournal );  
     },

     openTodayJournal : function(e) 
     {  
         var date = new Date();
         var title = &quot;JRL &quot;+ date.formatString( 'YYYY-0MM-0DD ddd' );

         var mainTitle = title;
         story.displayTiddler( null,mainTitle,DEFAULT_VIEW_TEMPLATE );
     } ,
}
//}}}
/***
''New todo''
***/
//{{{
config.macros.elnbNewTodo = {  

     label: &quot;new task&quot;,  
     tooltip: &quot;Create a new task&quot;,  
     category: &quot;task&quot;,
     tags: &quot;#future&quot;,

     handler: function ( place,macroName,params,wikifier,paramString,tiddler ) 
     {  
         var buttonLabel = this.label;  
         var buttonTip  = this.tooltip;  

         createTiddlyButton( place,buttonLabel,buttonTip,this.createTodo );  
     },

     createTodo: function(e) 
     {  
         var date = new Date();
         var author = config.options.txtUserName;

         var tid = version.extensions.elnb.newTID();
         var title = &quot;TSK-&quot; + tid;
         var subject = &quot;New task ...&quot;;
         var text = &quot;&quot;;

         var category =  config.macros.elnbNewTodo.category;
         var tags = config.macros.elnbNewTodo.tags;    

         store.saveTiddler( title,title,text,author,date,tags );
         store.setValue( title,&quot;category&quot;,category );       
         store.setValue( title,&quot;subject&quot;,subject );      

         story.displayTiddler(null, title, DEFAULT_EDIT_TEMPLATE);
     } ,
}
//}}}
/***
''New question''
***/
//{{{
config.macros.elnbNewQuestion = {  

     label: &quot;new question&quot;,  
     tooltip: &quot;Create a new question&quot;,  
     category: &quot;question&quot;,
     tags: &quot;#open&quot;,

     handler: function ( place,macroName,params,wikifier,paramString,tiddler ) 
     {  
         var buttonLabel = this.label;  
         var buttonTip  = this.tooltip;  

         createTiddlyButton( place,buttonLabel,buttonTip,this.createQuestion );  
     },

     createQuestion : function(e) 
     {  
         var date = new Date();
         var author = config.options.txtUserName;

         var tid = version.extensions.elnb.newTID();
         var title = &quot;Q-&quot; + tid;
         var subject = &quot;New question  ...&quot;;
         var text = &quot;&quot;;

         var category =  config.macros.elnbNewQuestion.category;
         var tags = config.macros.elnbNewQuestion.tags;    

         store.saveTiddler( title,title,text,author,date,tags );
         store.setValue( title,&quot;category&quot;,category );       
         store.setValue( title,&quot;subject&quot;,subject );      

         story.displayTiddler(null, title, DEFAULT_EDIT_TEMPLATE);
     } ,
}
//}}}
/***
''New meeting''
***/
//{{{
config.macros.elnbNewMeeting = {  

     label: &quot;new meeting&quot;,  
     tooltip: &quot;Create a new meeting  minutes&quot;,  
     category: &quot;meeting&quot;,
     tags: &quot;&quot;,

     handler: function ( place,macroName,params,wikifier,paramString,tiddler ) 
     {  
         var buttonLabel = this.label;  
         var buttonTip  = this.tooltip;  

         createTiddlyButton( place,buttonLabel,buttonTip,this.createMeeting);  
     },

     createMeeting: function(e) 
     {  
         var date = new Date();
         var author = config.options.txtUserName;

         var tid = version.extensions.elnb.newTID();
         var title = &quot;MM-&quot; + tid;
         var subject = &quot;New meeting...&quot;;
         var text = &quot;&quot;

         var category =  config.macros.elnbNewMeeting .category;
         var tags = config.macros.elnbNewMeeting .tags;    

         store.saveTiddler( title,title,text,author,date,tags );
         store.setValue( title,&quot;category&quot;,category );      

         store.setValue( title,&quot;subject&quot;,subject );    
         store.setValue( title,&quot;date&quot;,&quot;&quot; );       
         store.setValue( title,&quot;time&quot;,&quot;&quot; );       
         store.setValue( title,&quot;attendance&quot;,&quot;&quot; );       
         store.setValue( title,&quot;location&quot;,&quot;&quot; );       

         story.displayTiddler(null, title, DEFAULT_EDIT_TEMPLATE);
     } ,
}
//}}}
/***
''New reference''
***/
//{{{
config.macros.elnbNewReference = {  

     label: &quot;new reference&quot;,  
     tooltip: &quot;Create a new reference&quot;,  
     category: &quot;drawer&quot;,
     tags: &quot;&quot;,

     handler: function ( place,macroName,params,wikifier,paramString,tiddler ) 
     {  
         var buttonLabel = this.label;  
         var buttonTip  = this.tooltip;  

         createTiddlyButton( place,buttonLabel,buttonTip,this.createReference );  
     },

     createReference : function(e) 
     {  
         var date = new Date();
         var author = config.options.txtUserName;
   
         var title = &quot;FDR &quot;+ date.formatString( 'YYYY0MM0DD' ) +&quot;-XXX&quot;;
         var text = &quot;&quot;;

         var category =  config.macros.elnbNewReference.category;
         var tags = config.macros.elnbNewReference.tags;    

         store.saveTiddler( title,title,text,author,date,tags );
         store.setValue( title,&quot;category&quot;,category );         

         story.displayTiddler(null, title, DEFAULT_EDIT_TEMPLATE);
     } ,
}
//}}}

     </pre>
</div>
<div title="elnbPackage -  References Command" modifier="escdie" created="201011110553" modified="201011110555" tags="plugin %tw-elnb systemConfig elnbPackage">
<pre>/***
|Name|References Command|
|Description||
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on|TW References Command|
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|Hack|
***/

//{{{
config.commands.elnbReferences = {
   
   handlePopup :  function(popup,title)
   {  
	var references = store.getReferringTiddlers(title);
	var c = false;

	for(var r=0; r&lt;references.length; r++) 
        {
		if(references[r].title != title &amp;&amp; !references[r].isTagged(&quot;excludeLists&quot;)) 
                {
			elnbCreateTiddlyLink(createTiddlyElement(popup,&quot;li&quot;),references[r].title,true);
			c = true;
		}
	}
	if(!c)
		createTiddlyElement(popup,&quot;li&quot;,null,&quot;disabled&quot;,this.popupNone);
    },
    
    oldHandlePopup  : null,
};

config.commands.elnbReferences .oldHandlePopup  = config.commands.references.handlePopup ;
config.commands.references.handlePopup = config.commands.elnbReferences .handlePopup ;

//}}}
</pre>
</div>
<div title="elnbPackage - SyncCore Plugin" modifier="dger" created="201102051525" modified="201102061039" tags="%tw-elnb systemConfig %TBD">
<pre>/***
***/
//{{{

if( !version.extensions.elnb)
       version.extensions.elnb = {};

version.extensions.elnb.upgradeCore = {major: 1, minor: 0, revision: 0, date: new Date(2011,2,6)};  

//--
//-- 
//--

// The TW-eLNB core
var coreConn = config.extensions.elnb.elnbCore;

config.macros.elnbSync = {

        serverType: coreConn.serverType,
        serverHost: coreConn.serverHost,
        coreFile: coreConn.coreHost,

	listViewTemplate: {
		columns: [
			{name: 'Selected', field: 'selected', rowName: 'title', type: 'Selector'},
			{name: 'Tiddler', field: 'tiddler', title: &quot;Tiddler&quot;, type: 'Tiddler'},
			{name: 'Server Type', field: 'serverType', title: &quot;Server type&quot;, type: 'String'},
			{name: 'Server Host', field: 'serverHost', title: &quot;Server host&quot;, type: 'String'},
			{name: 'Server Workspace', field: 'serverWorkspace', title: &quot;Server workspace&quot;, type: 'String'},
			{name: 'Status', field: 'status', title: &quot;Synchronisation status&quot;, type: 'String'},
			{name: 'Server URL', field: 'serverUrl', title: &quot;Server URL&quot;, text: &quot;View&quot;, type: 'Link'}
			],
		rowClasses: [
			],
		buttons: [
			{caption: &quot;Sync these tiddlers&quot;, name: 'sync'}
			]},
	wizardTitle: &quot;Synchronize with TW-eLNB core&quot;,
	step1Title: &quot;Choose the tiddlers you want to synchronize&quot;,
	step1Html: &quot;&lt;input type='hidden' name='markList'&gt;&lt;/input&gt;&quot;, // DO NOT TRANSLATE
	syncLabel: &quot;sync&quot;,
	syncPrompt: &quot;Sync these tiddlers&quot;,
	hasChanged: &quot;Changed while unplugged&quot;,
	hasNotChanged: &quot;Unchanged while unplugged&quot;,
	syncStatusList: {
		none: {text: &quot;...&quot;, display:'none', className:'notChanged'},
		changedServer: {text: &quot;New version on server&quot;, display:null, className:'changedServer'},
		changedLocally: {text: &quot;Changed in local&quot;, display:null, className:'changedLocally'},
		changedBoth: {text: &quot;Changed in local and new version on server&quot;, display:null, className:'changedBoth'},
		notFound: {text: &quot;Not found on server&quot;, display:null, className:'notFound'},
		putToServer: {text: &quot;Saved update on server&quot;, display:null, className:'putToServer'},
		gotFromServer: {text: &quot;Retrieved update from server&quot;, display:null, className:'gotFromServer'}
		}
};

//--
//-- Sync macro
//--

// Sync state.
var currSync = null;

// sync macro
config.macros.elnbSync.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	if(!wikifier.isStatic)
		this.startSync(place);
};

config.macros.elnbSync.cancelSync = function()
{
	currSync = null;
};

config.macros.elnbSync.startSync = function(place)
{
	if(currSync)
		config.macros.elnbSync.cancelSync();
	currSync = {};
	currSync.syncList = this.getSyncableTiddlers();
	currSync.syncTasks = this.createSyncTasks(currSync.syncList);
	this.preProcessSyncableTiddlers(currSync.syncList);
	var wizard = new Wizard();
	currSync.wizard = wizard;
	wizard.createWizard(place,this.wizardTitle);
	wizard.addStep(this.step1Title,this.step1Html);
	var markList = wizard.getElement(&quot;markList&quot;);
	var listWrapper = document.createElement(&quot;div&quot;);
	markList.parentNode.insertBefore(listWrapper,markList);
	currSync.listView = ListView.create(listWrapper,currSync.syncList,this.listViewTemplate);
	this.processSyncableTiddlers(currSync.syncList);
	wizard.setButtons([{caption: this.syncLabel, tooltip: this.syncPrompt, onClick: this.doSync}]);
};

config.macros.elnbSync.getSyncableTiddlers = function()
{
	var list = [];
	store.forEachTiddler(function(title,tiddler) {
		var syncItem = {};
                var thisMacro = config.macros.elnbSync;
		syncItem.serverType = tiddler.getServerType();
		syncItem.serverHost = tiddler.fields['server.host'];

		if(syncItem.serverType &amp;&amp; syncItem.serverHost ==  thisMacro.serverHost) {
		//if(syncItem.serverType &amp;&amp; syncItem.serverHost) {
                        syncItem.serverHost = thisMacro.coreFile;
                         
			syncItem.adaptor = new config.adaptors[syncItem.serverType];
			syncItem.serverHost = syncItem.adaptor.fullHostName(syncItem.serverHost);
			syncItem.serverWorkspace = tiddler.fields['server.workspace'];
			syncItem.tiddler = tiddler;
			syncItem.title = tiddler.title;
			syncItem.isTouched = tiddler.isTouched();
			syncItem.selected = syncItem.isTouched;
			
                        syncItem.syncStatus = thisMacro.syncStatusList[syncItem.isTouched ? &quot;changedLocally&quot; : &quot;none&quot;];
			//syncItem.syncStatus = thisMacro.syncStatusList[&quot;none&quot;];

                        syncItem.status = syncItem.syncStatus.text;
			list.push(syncItem);
		}
		});
	list.sort(function(a,b) {return a.title &lt; b.title ? -1 : (a.title == b.title ? 0 : +1);});
	return list;
};

config.macros.elnbSync.preProcessSyncableTiddlers = function(syncList)
{
    displayMessage( &quot;elnbSync.preProcessSyncableTiddlers - syncItems len: &quot; + syncList.length );
    var thisMacro = config.macros.elnbSync;

    for(var i=0; i&lt;syncList.length; i++) {
		var si = syncList[i];
          
		//si.serverUrl = si.adaptor.generateTiddlerInfo(si.tiddler).uri;   

        var tiddler = si.tiddler;
        tiddler.fields['server.host'] = thisMacro.coreFile;   
    
		si.serverUrl = si.adaptor.generateTiddlerInfo(tiddler).uri; 
	}
};

config.macros.elnbSync.processSyncableTiddlers = function(syncList)
{
    displayMessage( &quot;elnbSync.processSyncableTiddlers - syncItems len: &quot; + syncList.length );
	for(var i=0; i&lt;syncList.length; i++) {
		var si = syncList[i];
		if(si.syncStatus.display)
			si.rowElement.style.display = si.syncStatus.display;
		if(si.syncStatus.className)
			si.rowElement.className = si.syncStatus.className;
	}
};

config.macros.elnbSync.createSyncTasks = function(syncList)
{
	var syncTasks = [];
	for(var i=0; i&lt;syncList.length; i++) {
		var si = syncList[i];
		var r = null;
		for(var j=0; j&lt;syncTasks.length; j++) {
			var cst = syncTasks[j];
			if(si.serverType == cst.serverType &amp;&amp; si.serverHost == cst.serverHost &amp;&amp; si.serverWorkspace == cst.serverWorkspace)
				r = cst;
		}
		if(r) {
			si.syncTask = r;
			r.syncItems.push(si);
		} else {
			si.syncTask = this.createSyncTask(si);
			syncTasks.push(si.syncTask);
		}
	}
	return syncTasks;
};

config.macros.elnbSync.createSyncTask = function(syncItem)
{
	var st = {};
	st.serverType = syncItem.serverType;
	st.serverHost = syncItem.serverHost;
	st.serverWorkspace = syncItem.serverWorkspace;
	st.syncItems = [syncItem];

	var openWorkspaceCallback = function(context,syncItems) {
		if(context.status) {
			context.adaptor.getTiddlerList(context,syncItems,getTiddlerListCallback);
			return true;
		}
		displayMessage(context.statusText);
		return false;
	};

	var getTiddlerListCallback = function(context,sycnItems) {
		var me = config.macros.elnbSync;
		if(!context.status) {
			displayMessage(context.statusText);
			return false;
		}
		syncItems = context.userParams;
		var tiddlers = context.tiddlers;
		for(var i=0; i&lt;syncItems.length; i++) {
			var si = syncItems[i];
			var f = tiddlers.findByField(&quot;title&quot;,si.title);
			if(f !== null) {
				if(tiddlers[f].fields['server.page.revision'] &gt; si.tiddler.fields['server.page.revision']) {
					si.syncStatus = me.syncStatusList[si.isTouched ? 'changedBoth' : 'changedServer'];
				}
			} else {
				si.syncStatus = me.syncStatusList.notFound;
			}
			me.updateSyncStatus(si);
		}
		return true;
	};
	var context = {host:st.serverHost,workspace:st.serverWorkspace};
	syncItem.adaptor.openHost(st.serverHost);
	syncItem.adaptor.openWorkspace(st.serverWorkspace,context,st.syncItems,openWorkspaceCallback);
	return st;
};

config.macros.elnbSync.updateSyncStatus = function(syncItem)
{
	var e = syncItem.colElements[&quot;status&quot;];
	removeChildren(e);
	createTiddlyText(e,syncItem.syncStatus.text);
	syncItem.rowElement.style.display = syncItem.syncStatus.display;
	if(syncItem.syncStatus.className)
		syncItem.rowElement.className = syncItem.syncStatus.className;
};

config.macros.elnbSync.doSync = function(e)
{
        displayMessage( &quot;Sync TW-eLNB core - elnbSync.doSync&quot; );

	var me = config.macros.elnbSync;
	var getTiddlerCallback = function(context,syncItem) {
		if(syncItem) {
			var tiddler = context.tiddler;
			store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields,true,tiddler.created);
			syncItem.syncStatus = me.syncStatusList.gotFromServer;
			me.updateSyncStatus(syncItem);
		}
	};
	var putTiddlerCallback = function(context,syncItem) {
		if(syncItem) {
			store.resetTiddler(context.title);
			syncItem.syncStatus = me.syncStatusList.putToServer;
			me.updateSyncStatus(syncItem);
		}
	};

	var rowNames = ListView.getSelectedRows(currSync.listView);
	var sl = me.syncStatusList;
	for(var i=0; i&lt;currSync.syncList.length; i++) {
		var si = currSync.syncList[i];
		if(rowNames.indexOf(si.title) != -1) {
			var errorMsg = &quot;Error in doSync: &quot;;
			try {
				var r = true;
				switch(si.syncStatus) {

                                // Not allowed to update TW-eLNB core 
                                // Therefore, always there is change on server the local file is updated.
                           		
				case sl.changedServer:
				case sl.changedBoth:
					var context = {&quot;workspace&quot;: si.serverWorkspace};
					r = si.adaptor.getTiddler(si.title,context,si,getTiddlerCallback);
					break;
				case sl.notFound:
				case sl.changedLocally:
				//case sl.changedBoth:
                                        // Not allowed to update TW-eLNB core 
					//r = si.adaptor.putTiddler(si.tiddler,null,si,putTiddlerCallback);
					break;
				default:
					break;
				}
				if(!r)
					displayMessage(errorMsg + r);
			} catch(ex) {
				if(ex.name == &quot;TypeError&quot;)
					displayMessage(&quot;sync operation unsupported: &quot; + ex.message);
				else
					displayMessage(errorMsg + ex.message);
			}
		}
	}
	return false;
};


//--
// Backstage tasks
//-- 

config.tasks.elnbSync = {  
    text: &quot;elnbSync&quot;, 
    tooltip: &quot;Sync to tw-elnb&quot;, 
    content: '&lt;&lt;elnbSync&gt;&gt;'
}  
   
config.backstageTasks.push( &quot;elnbSync&quot; );  

//}}}
</pre>
</div>
<div title="elnbPackage - TagCloud Plugin" modifier="escdie" created="201011060908" modified="201011092210" tags="systemConfig plugin pluginInfo elnbPackage %tw-elnb %elnb-hack">
<pre>/***
|Name|elnbTagCloudPlugin|
|Description|Present a 'cloud' of tags (or links) using proportional font display|
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on|http://www.TiddlyTools.com/#TagCloudPlugin|
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|plugin|

''@@color:blue;font-size:125%;Hacked to be used with tw-elnb@@''

!Usage
&lt;&lt;&lt;
{{{
&lt;&lt;elnbTagCloud type action:... limit:... tag tag tag ...&gt;&gt;
&lt;&lt;elnbTagCloud type action:... limit:... +TiddlerName&gt;&gt;
&lt;&lt;elnbTagCloud type action:... limit:... -TiddlerName&gt;&gt;
&lt;&lt;elnbTagCloud type action:... limit:... =tagvalue&gt;&gt;
}}}
where:
* //type// is a keyword, one of:
** ''tags'' (default) - displays a cloud of tags, based on frequency of use
** ''links'' - displays a cloud of tiddlers, based on number of links //from// each tiddler
** ''references'' - displays a cloud of tiddlers, based on number of links //to// each tiddler
* ''action:popup'' (default) - clicking a cloud item shows a popup with links to related tiddlers&lt;br&gt;//or//&lt;br&gt; ''action:goto'' - clicking a cloud item immediately opens the tiddler corresponding to that item
* ''limit:N'' (optional) - restricts the cloud display to only show the N most popular tags/links
* ''tag tag tag...'' (or ''title title title'' if ''links''/''references'' is used)&lt;br&gt;shows all tags/links in the document //except// for those listed as macro parameters
* ''+TiddlerName''&lt;br&gt;show only tags/links read from a space-separated, bracketed list stored in a separate tiddler.
* ''-TiddlerName''&lt;br&gt;show all tags/links //except// those read from a space-separated, bracketed list stored in a separate tiddler.
* ''=tagvalue'' (//only if type=''tags''//)&lt;br&gt;shows only tags that are themselves tagged with the indicated tag value (i.e., ~TagglyTagging usage)
//note: for backward-compatibility, you can also use the macro {{{&lt;&lt;tagCloud ...&gt;&gt;}}} in place of {{{&lt;&lt;cloud ...&gt;&gt;}}}//
&lt;&lt;&lt;
!Examples
&lt;&lt;&lt;
//all tags excluding&lt;&lt;tag systemConfig&gt;&gt;, &lt;&lt;tag excludeMissing&gt;&gt; and &lt;&lt;tag script&gt;&gt;//
{{{&lt;&lt;elnbTagCloud systemConfig excludeMissing script&gt;&gt;}}}
{{groupbox{&lt;&lt;elnbTagCloud systemConfig excludeMissing script&gt;&gt;}}}
//top 10 tags excluding&lt;&lt;tag systemConfig&gt;&gt;, &lt;&lt;tag excludeMissing&gt;&gt; and &lt;&lt;tag script&gt;&gt;//
{{{&lt;&lt;elnbTagCloud limit:10 systemConfig excludeMissing script&gt;&gt;}}}
{{groupbox{&lt;&lt;elnbTagCloud limit:10 systemConfig excludeMissing script&gt;&gt;}}}
//tags listed in// [[FavoriteTags]]
{{{&lt;&lt;elnbTagCloud +FavoriteTags&gt;&gt;}}}
{{groupbox{&lt;&lt;elnbTagCloud +FavoriteTags&gt;&gt;}}}
//tags NOT listed in// [[FavoriteTags]]
{{{&lt;&lt;elnbTagCloud -FavoriteTags&gt;&gt;}}}
{{groupbox{&lt;&lt;elnbTagCloud -FavoriteTags&gt;&gt;}}}
//links to tiddlers tagged with 'package'//
{{{&lt;&lt;elnbTagCloud action:goto =package&gt;&gt;}}}
{{groupbox{&lt;&lt;elnbTagCloud action:goto =package&gt;&gt;}}}
//top 20 most referenced tiddlers//
{{{&lt;&lt;elnbTagCloud references limit:20&gt;&gt;}}}
{{groupbox{&lt;&lt;elnbTagCloud references limit:20&gt;&gt;}}}
//top 20 tiddlers that contain the most links//
{{{&lt;&lt;elnbTagCloud links limit:20&gt;&gt;}}}
{{groupbox{&lt;&lt;elnbTagCloud links limit:20&gt;&gt;}}}
&lt;&lt;&lt;
!Revisions
&lt;&lt;&lt;
2009.07.17 [1.7.0] added {{{-TiddlerName}}} parameter to exclude tags that are listed in the indicated tiddler
2009.02.26 [1.6.0] added {{{action:...}}} parameter to apply popup vs. goto action when clicking cloud items
2009.02.05 [1.5.0] added ability to show links or back-links (references) instead of tags and renamed macro to {{{&lt;&lt;cloud&gt;&gt;}}} to reflect more generalized usage.
2008.12.16 [1.4.2] corrected group calculation to prevent 'group=0' error
2008.12.16 [1.4.1] revised tag filtering so excluded tags don't affect calculations
2008.12.15 [1.4.0] added {{{limit:...}}} parameter to restrict the number of tags displayed to the top N most popular
2008.11.15 [1.3.0] added {{{+TiddlerName}}} parameter to include only tags that are listed in the indicated tiddler
2008.09.05 [1.2.0] added '=tagname' parameter to include only tags that are themselves tagged with the specified value (i.e., ~TagglyTagging usage)
2008.07.03 [1.1.0] added 'segments' property to macro object.  Extensive code cleanup
&lt;&lt;&lt;
!Code
***/
//{{{
version.extensions.TagCloudPlugin= {major: 1, minor: 7 , revision: 0, date: new Date(2009,7,17)};
//Originally created by Clint Checketts, contributions by Jonny Leroy and Eric Shulman
//Currently maintained and enhanced by Eric Shulman
//}}}
//{{{
config.macros.elnbTagCloud = {

	tagstip: &quot;%1 tiddlers tagged with '%0'&quot;,
	refslabel: &quot; (%0 references)&quot;,
	refstip: &quot;%1 tiddlers have links to '%0'&quot;,
	linkslabel: &quot; (%0 links)&quot;,
	linkstip: &quot;'%0' has links to %1 other tiddlers&quot;,
	groups: 9,
    
	init: function() {
    
        config.shadowTiddlers.StyleSheetTagCloud=
			'/*{{{*/\n'
			+'.tagCloud span {line-height: 3.5em; margin:3px;}\n'
			+'.tagCloud1{font-size: 80%;}\n'
			+'.tagCloud2{font-size: 100%;}\n'
			+'.tagCloud3{font-size: 120%;}\n'
			+'.tagCloud4{font-size: 140%;}\n'
			+'.tagCloud5{font-size: 160%;}\n'
			+'.tagCloud6{font-size: 180%;}\n'
			+'.tagCloud7{font-size: 200%;}\n'
			+'.tagCloud8{font-size: 220%;}\n'
			+'.tagCloud9{font-size: 240%;}\n'
			+'/*}}}*/\n';
            
		setStylesheet(store.getTiddlerText('StyleSheetTagCloud'),'tagCloudsStyles');
	},
    
    // get list of links to existing tiddlers and shadows
	getLinks: function(tiddler) { 
    
		if (!tiddler.linksUpdated) tiddler.changed();
		var list=[]; for (var i=0; i&lt;tiddler.links.length; i++) {
			var title=tiddler.links[i];
			if (store.isShadowTiddler(title)||store.tiddlerExists(title))
				list.push(title);
		}
		return list;
	
    },
	handler: function(place,macroName,params) {
    
		// unpack params
		var inc=[]; var ex=[]; var limit=0; var action='popup';
		var links=(params[0]&amp;&amp;params[0].toLowerCase()=='links'); if (links) params.shift();
		var refs=(params[0]&amp;&amp;params[0].toLowerCase()=='references'); if (refs) params.shift();
		if (params[0]&amp;&amp;params[0].substr(0,7).toLowerCase()=='action:')
			action=params.shift().substr(7).toLowerCase();
		if (params[0]&amp;&amp;params[0].substr(0,6).toLowerCase()=='limit:')
			limit=parseInt(params.shift().substr(6));
		while (params.length) {
			if (params[0].substr(0,1)=='+') { // read taglist from tiddler
				inc=inc.concat(store.getTiddlerText(params[0].substr(1),'').readBracketedList());
			} else if (params[0].substr(0,1)=='-') { // exclude taglist from tiddler
				ex=ex.concat(store.getTiddlerText(params[0].substr(1),'').readBracketedList());
			} else if (params[0].substr(0,1)=='=') { // get tag list using tagged tags
				var tagged=store.getTaggedTiddlers(params[0].substr(1));
				for (var t=0; t&lt;tagged.length; t++) inc.push(tagged[t].title);
			} else ex.push(params[0]); // exclude params
			params.shift();
		}
        
		// get all items, include/exclude specific items
		var items=[];
		var list=(links||refs)?store.getTiddlers('title','excludeLists'):store.getTags();
		for (var t=0; t&lt;list.length; t++) {
			var title=(links||refs)?list[t].title:list[t][0];
			if (links)	var count=this.getLinks(list[t]).length;
			else if (refs)	var count=store.getReferringTiddlers(title).length;
			else 		var count=list[t][1];
			if ((!inc.length||inc.contains(title))&amp;&amp;(!ex.length||!ex.contains(title)))
				items.push({ title:title, count:count });
		}
		if(!items.length) return;
        
		// sort by decending count, limit results (optional)
		items=items.sort(function(a,b){return(a.count==b.count)?0:(a.count&gt;b.count?-1:1);});
		while (limit &amp;&amp; items.length&gt;limit) items.pop();
        
		// find min/max and group size
		var most=items[0].count;
		var least=items[items.length-1].count;
		var groupSize=(most-least+1)/this.groups;
        
		// sort by title and draw the cloud of items
		items=items.sort(function(a,b){return(a.title==b.title)?0:(a.title&gt;b.title?1:-1);});
		var cloudWrapper = createTiddlyElement(place,'div',null,'tagCloud',null);
        
		for (var t=0; t&lt;items.length; t++) {
			cloudWrapper.appendChild(document.createTextNode(' '));
			var group=Math.ceil((items[t].count-least)/groupSize)||1;
			var className='tagCloudtag tagCloud'+group;
			var tip=refs?this.refstip:links?this.linkstip:this.tagstip;
			tip=tip.format([items[t].title,items[t].count]);
            
            // TAG/LINK/REFERENCES GOTO
			if (action=='goto') 
            { 
				var btn=createTiddlyLink(cloudWrapper,items[t].title,true,className);
				btn.title=tip;
				btn.style.fontWeight='normal';
			} 
            
            // TAG POPUP
            else if (!links&amp;&amp;!refs) 
            { 
				var btn=createTiddlyButton(cloudWrapper,items[t].title,tip,elnbOnClickTag,className);
				btn.setAttribute('tag',items[t].title);
			} 
            
             // LINK/REFERENCES POPUP
            else 
            {
				var btn=createTiddlyButton(cloudWrapper,items[t].title,tip,
					function(ev) { var e=ev||window.event; var cmt=config.macros.cloud;
						var popup = Popup.create(this);
						var title = this.getAttribute('tiddler');
						var count = this.getAttribute('count');
						var refs  = this.getAttribute('refs')=='T';
						var links = this.getAttribute('links')=='T';
						var label = (refs?cmt.refslabel:cmt.linkslabel).format([count]);
						createTiddlyLink(popup,title,true);
						createTiddlyText(popup,label);
						createTiddlyElement(popup,'hr');
                        
						if (refs) {
							popup.setAttribute('tiddler',title);
							config.commands.references.handlePopup(popup,title);
						}
                        
						if (links) {
							var tiddler = store.fetchTiddler(title);
							var links=config.macros.cloud.getLinks(tiddler);
							for(var i=0;i&lt;links.length;i++)
								createTiddlyLink(createTiddlyElement(popup,'li'),
									links[i],true);
						}
                        
						Popup.show();
						e.cancelBubble=true; if(e.stopPropagation) e.stopPropagation();
						return false;
					}, className);
                    
				btn.setAttribute('tiddler',items[t].title);
				btn.setAttribute('count',items[t].count);
				btn.setAttribute('refs',refs?'T':'F');
				btn.setAttribute('links',links?'T':'F');
				btn.title=tip;
			}
		}
	}
};
//}}}</pre>
</div>
<div title="elnbPackage - Tagging Macro" modifier="escdie" created="201011161715" modified="201011161843" tags="plugin %tw-elnb systemConfig elnbPackage">
<pre>/***
|Name|Tagging Macro|
|Description||
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on| |
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|Hack|
***/

//{{{
config.macros.elnbTagging = {
   
   handler :   function(place,macroName,params,wikifier,paramString,tiddler)
   {
    params = paramString.parseParams(&quot;anon&quot;,null,true,false,false);
    var ul = createTiddlyElement(place,&quot;ul&quot;);
    var title = getParam(params,&quot;anon&quot;,&quot;&quot;);
    if(title == &quot;&quot; &amp;&amp; tiddler instanceof Tiddler)
        title = tiddler.title;
    var sep = getParam(params,&quot;sep&quot;,&quot; &quot;);
    ul.setAttribute(&quot;title&quot;,this.tooltip.format([title]));
    var tagged = store.getTaggedTiddlers(title);
    var prompt = tagged.length == 0 ? this.labelNotTag : this.label;
    createTiddlyElement(ul,&quot;li&quot;,null,&quot;listTitle&quot;,prompt.format([title,tagged.length]));

    for(var t=0; t&lt;tagged.length; t++) 
   {
        elnbCreateTiddlyLink(createTiddlyElement(ul,&quot;li&quot;),tagged[t].title,true);
        if(t&lt;tagged.length-1)
            createTiddlyText(ul,sep);
    }
   },
    
    oldHandler : null,
};

config.macros.elnbTagging .oldHandler = config.macros.tagging.handler;
config.macros.tagging.handler = config.macros.elnbTagging .handler;

//}}}
</pre>
</div>
<div title="elnbPackage - Tags Macro" modifier="escdie" created="201011061522" modified="201011092211" tags="plugin %tw-elnb systemConfig elnbPackage">
<pre>/***
|Name|elnbTags Macro|
|Description||
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on|http://www.TiddlyTools.com/#TagCloudPlugin|
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|Plugin|
***/

//{{{
config.macros.elnbTags = {  
    
    handler : function(place,macroName,params,wikifier,paramString,tiddler)
    {
        params = paramString.parseParams(&quot;anon&quot;,null,true,false,false);
        
        var ul = createTiddlyElement(place,&quot;ul&quot;);
        var title = getParam(params,&quot;anon&quot;,&quot;&quot;);
        if(title &amp;&amp; store.tiddlerExists(title))
            tiddler = store.getTiddler(title);
        var sep = getParam(params,&quot;sep&quot;,&quot; &quot;);
        var lingo = config.views.wikified.tag;
        var label = null;
        for(var t=0; t&lt;tiddler.tags.length; t++) 
        {
            var tag = store.getTiddler(tiddler.tags[t]);
            if(!tag || !tag.tags.contains(&quot;excludeLists&quot;))
            {
                if(!label)
                    label = createTiddlyElement(ul,&quot;li&quot;,null,&quot;listTitle&quot;,lingo.labelTags.format([tiddler.title]));
                
                //createTagButton(createTiddlyElement(ul,&quot;li&quot;),tiddler.tags[t],tiddler.title);
                elnbCreateTagButton(createTiddlyElement(ul,&quot;li&quot;),tiddler.tags[t],tiddler.title);
                
                if(t&lt;tiddler.tags.length-1)
                    createTiddlyText(ul,sep);
            }
        }
        if(!label)
            createTiddlyElement(ul,&quot;li&quot;,null,&quot;listTitle&quot;,lingo.labelNoTags.format([tiddler.title]));
    },
    
    oldHandler : null,
};

config.macros.elnbTags.oldHandler = config.macros.tags.handler;
config.macros.tags.handler = config.macros.elnbTags.handler;
//}}}</pre>
</div>
<div title="elnbPackage - TiddlersBar Plugin" modifier="escdie" created="201009141744" modified="201011181932" tags="plugin pluginInfo systemConfig %tw-elnb %elnb-hack">
<pre>/***
|''Name:''|TiddlersBarPlugin|
|''Description:''|A bar to switch between tiddlers through tabs (like browser tabs bar).|
|''Version:''|1.2.5|
|''Date:''|Jan 18,2008|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.1.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0, others|

''@@color:blue;font-size:125%;Hacked to be used with tw-elnb@@''

!Demos
On [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], open several tiddlers to use the tabs bar.
!Installation
#import this tiddler from [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] (tagged as systemConfig)
#save and reload
#''if you're using a custom [[PageTemplate]]'', add {{{&lt;div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'&gt;&lt;/div&gt;}}} before {{{&lt;div id='tiddlerDisplay'&gt;&lt;/div&gt;}}}
#optionally, adjust StyleSheetTiddlersBar
!Tips
*Doubleclick on the tiddlers bar (where there is no tab) create a new tiddler.
*Tabs include a button to close {{{x}}} or save {{{!}}} their tiddler.
*By default, click on the current tab close all others tiddlers.
!Configuration options 
&lt;&lt;option chkDisableTabsBar&gt;&gt; Disable the tabs bar (to print, by example).
&lt;&lt;option chkHideTabsBarWhenSingleTab &gt;&gt; Automatically hide the tabs bar when only one tiddler is displayed. 
&lt;&lt;option txtSelectedTiddlerTabButton&gt;&gt; ''selected'' tab command button.
&lt;&lt;option txtPreviousTabKey&gt;&gt; previous tab access key.
&lt;&lt;option txtNextTabKey&gt;&gt; next tab access key.
!Code
***/
//{{{
config.options.chkDisableTabsBar = config.options.chkDisableTabsBar ? config.options.chkDisableTabsBar : false;
config.options.chkHideTabsBarWhenSingleTab  = config.options.chkHideTabsBarWhenSingleTab  ? config.options.chkHideTabsBarWhenSingleTab  : false;
config.options.txtSelectedTiddlerTabButton = config.options.txtSelectedTiddlerTabButton ? config.options.txtSelectedTiddlerTabButton : &quot;closeOthers&quot;;
config.options.txtPreviousTabKey = config.options.txtPreviousTabKey ? config.options.txtPreviousTabKey : &quot;&quot;;
config.options.txtNextTabKey = config.options.txtNextTabKey ? config.options.txtNextTabKey : &quot;&quot;;
config.macros.tiddlersBar = {
	tooltip : &quot;see &quot;,
	tooltipClose : &quot;click here to close this tab&quot;,
	tooltipSave : &quot;click here to save this tab&quot;,
	promptRename : &quot;Enter tiddler new name&quot;,
	currentTiddler : &quot;&quot;,
	previousState : false,
	previousKey : config.options.txtPreviousTabKey,
	nextKey : config.options.txtNextTabKey,	
	tabsAnimationSource : null, //use document.getElementById(&quot;tiddlerDisplay&quot;) if you need animation on tab switching.
	handler: function(place,macroName,params) {
		var previous = null;
		if (config.macros.tiddlersBar.isShown())
			story.forEachTiddler(function(title,e){
				if (title==config.macros.tiddlersBar.currentTiddler){
					var d = createTiddlyElement(null,&quot;span&quot;,null,&quot;tab tabSelected&quot;);
					config.macros.tiddlersBar.createActiveTabButton(d,title);
					if (previous &amp;&amp; config.macros.tiddlersBar.previousKey) previous.setAttribute(&quot;accessKey&quot;,config.macros.tiddlersBar.nextKey);
					previous = &quot;active&quot;;
				}
				else {
					var d = createTiddlyElement(place,&quot;span&quot;,null,&quot;tab tabUnselected&quot;);
                                        
                    var old_title  = title;                                        
                    var subject = store.getTiddlerSubjectByTitle( title );
                    
                    title = subject;                    
					var btn = createTiddlyButton(d,title,config.macros.tiddlersBar.tooltip + title,config.macros.tiddlersBar.onSelectTab);

                    title = old_title;
			        btn.setAttribute(&quot;tiddler&quot;, title);
                    
					if (previous==&quot;active&quot; &amp;&amp; config.macros.tiddlersBar.nextKey) btn.setAttribute(&quot;accessKey&quot;,config.macros.tiddlersBar.previousKey);
					previous=btn;
				}
				var isDirty =story.isDirty(title);
				var c = createTiddlyButton(d,isDirty ?&quot;!&quot;:&quot;x&quot;,isDirty?config.macros.tiddlersBar.tooltipSave:config.macros.tiddlersBar.tooltipClose, isDirty ? config.macros.tiddlersBar.onTabSave : config.macros.tiddlersBar.onTabClose,&quot;tabButton&quot;);
				c.setAttribute(&quot;tiddler&quot;, title);
				if (place.childNodes) {
					place.insertBefore(document.createTextNode(&quot; &quot;),place.firstChild); // to allow break line here when many tiddlers are open
					place.insertBefore(d,place.firstChild); 
				}
				else place.appendChild(d);
			})
	}, 
	refresh: function(place,params){
		removeChildren(place);
		config.macros.tiddlersBar.handler(place,&quot;tiddlersBar&quot;,params);
		if (config.macros.tiddlersBar.previousState!=config.macros.tiddlersBar.isShown()) {
			story.refreshAllTiddlers();
			if (config.macros.tiddlersBar.previousState) story.forEachTiddler(function(t,e){e.style.display=&quot;&quot;;});
			config.macros.tiddlersBar.previousState = !config.macros.tiddlersBar.previousState;
		}
	},
	isShown : function(){
		if (config.options.chkDisableTabsBar) return false;
		if (!config.options.chkHideTabsBarWhenSingleTab) return true;
		var cpt=0;
		story.forEachTiddler(function(){cpt++});
		return (cpt&gt;1);
	},
	selectNextTab : function(){  //used when the current tab is closed (to select another tab)
		var previous=&quot;&quot;;
		story.forEachTiddler(function(title){
			if (!config.macros.tiddlersBar.currentTiddler) {
				story.displayTiddler(null,title);
				return;
			}
			if (title==config.macros.tiddlersBar.currentTiddler) {
				if (previous) {
					story.displayTiddler(null,previous);
					return;
				}
				else config.macros.tiddlersBar.currentTiddler=&quot;&quot;; 	// so next tab will be selected
			}
			else previous=title;
			});		
	},
	onSelectTab : function(e){
		var t = this.getAttribute(&quot;tiddler&quot;);
		if (t) story.displayTiddler(null,t);
		return false;
	},
	onTabClose : function(e){
		var t = this.getAttribute(&quot;tiddler&quot;);
		if (t) {
			if(story.hasChanges(t) &amp;&amp; !readOnly) {
				if(!confirm(config.commands.cancelTiddler.warning.format([t])))
				return false;
			}
			story.closeTiddler(t);
		}
		return false;
	},
	onTabSave : function(e) {
		var t = this.getAttribute(&quot;tiddler&quot;);
		if (!e) e=window.event;
		if (t) config.commands.saveTiddler.handler(e,null,t);
		return false;
	},
	onSelectedTabButtonClick : function(event,src,title) {
		var t = this.getAttribute(&quot;tiddler&quot;);
		if (!event) event=window.event;
		if (t &amp;&amp; config.options.txtSelectedTiddlerTabButton &amp;&amp; config.commands[config.options.txtSelectedTiddlerTabButton])
			config.commands[config.options.txtSelectedTiddlerTabButton].handler(event, src, t);
		return false;
	},
	onTiddlersBarAction: function(event) {
		var source = event.target ? event.target.id : event.srcElement.id; // FF uses target and IE uses srcElement;
		if (source==&quot;tiddlersBar&quot;) story.displayTiddler(null,'New Tiddler',DEFAULT_EDIT_TEMPLATE,false,null,null);
	},
	createActiveTabButton : function(place,title) {
		if (config.options.txtSelectedTiddlerTabButton &amp;&amp; config.commands[config.options.txtSelectedTiddlerTabButton]) {

            var old_title  = title;                                        
            var subject = store.getTiddlerSubjectByTitle( title );
            
            title = subject;                    
            var btn = createTiddlyButton(place, title, config.commands[config.options.txtSelectedTiddlerTabButton].tooltip, config.macros.tiddlersBar.onSelectedTabButtonClick);

            title = old_title;
			btn.setAttribute(&quot;tiddler&quot;, title);
		}
		else
			createTiddlyText(place,title);
	}
}

story.coreCloseTiddler = story.coreCloseTiddler? story.coreCloseTiddler : story.closeTiddler;
story.coreDisplayTiddler = story.coreDisplayTiddler ? story.coreDisplayTiddler : story.displayTiddler;

story.closeTiddler = function(title,animate,unused) {
	if (title==config.macros.tiddlersBar.currentTiddler)
		config.macros.tiddlersBar.selectNextTab();
	story.coreCloseTiddler(title,false,unused); //disable animation to get it closed before calling tiddlersBar.refresh
	var e=document.getElementById(&quot;tiddlersBar&quot;);
	if (e) config.macros.tiddlersBar.refresh(e,null);
}

story.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle){
	story.coreDisplayTiddler(config.macros.tiddlersBar.tabsAnimationSource,tiddler,template,animate,unused,customFields,toggle);
	var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler;  
	if (config.macros.tiddlersBar.isShown()) {
		story.forEachTiddler(function(t,e){
			if (t!=title) e.style.display=&quot;none&quot;;
			else e.style.display=&quot;&quot;;
		})
		config.macros.tiddlersBar.currentTiddler=title;
	}
	var e=document.getElementById(&quot;tiddlersBar&quot;);
	if (e) config.macros.tiddlersBar.refresh(e,null);
}

var coreRefreshPageTemplate = coreRefreshPageTemplate ? coreRefreshPageTemplate : refreshPageTemplate;
refreshPageTemplate = function(title) {
	coreRefreshPageTemplate(title);
	if (config.macros.tiddlersBar) config.macros.tiddlersBar.refresh(document.getElementById(&quot;tiddlersBar&quot;));
}

ensureVisible=function (e) {return 0} //disable bottom scrolling (not useful now)

config.shadowTiddlers.StyleSheetTiddlersBar = &quot;/*{{{*/\n&quot;;
config.shadowTiddlers.StyleSheetTiddlersBar += &quot;#tiddlersBar .button {border:0}\n&quot;;
config.shadowTiddlers.StyleSheetTiddlersBar += &quot;#tiddlersBar .tab {white-space:nowrap}\n&quot;;
config.shadowTiddlers.StyleSheetTiddlersBar += &quot;#tiddlersBar {padding : 1em 0.5em 2px 0.5em}\n&quot;;
config.shadowTiddlers.StyleSheetTiddlersBar += &quot;.tabUnselected .tabButton, .tabSelected .tabButton {padding : 0 2px 0 2px; margin: 0 0 0 4px;}\n&quot;;
config.shadowTiddlers.StyleSheetTiddlersBar += &quot;.tiddler, .tabContents {border:1px [[ColorPalette::TertiaryPale]] solid;}\n&quot;;
config.shadowTiddlers.StyleSheetTiddlersBar +=&quot;/*}}}*/&quot;;
store.addNotification(&quot;StyleSheetTiddlersBar&quot;, refreshStyles);

config.refreshers.none = function(){return true;}
config.shadowTiddlers.PageTemplate=config.shadowTiddlers.PageTemplate.replace(/&lt;div id='tiddlerDisplay'&gt;&lt;\/div&gt;/m,&quot;&lt;div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'&gt;&lt;/div&gt;\n&lt;div id='tiddlerDisplay'&gt;&lt;/div&gt;&quot;);

//}}}</pre>
</div>
<div title="elnbPackage - Timeline Macro" modifier="escdie" created="201011092012" modified="201011092202" tags="plugin %tw-elnb systemConfig elnbPackage">
<pre>/***
|Name|elnbTimeline Macro|
|Description||
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on| |
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|Hack|
***/

//{{{
config.macros.elnbTimeline = {

handler : function(place,macroName,params)
{
	var field = params[0] || &quot;modified&quot;;
	var tiddlers = store.reverseLookup(&quot;tags&quot;,&quot;excludeLists&quot;,false,field);
	var lastDay = &quot;&quot;;
	var last = params[1] ? tiddlers.length-Math.min(tiddlers.length,parseInt(params[1])) : 0;
	var dateFormat = params[2] || this.dateFormat;
	
        for(var t=tiddlers.length-1; t&gt;=last; t--) 
        {
		var tiddler = tiddlers[t];
		var theDay = tiddler[field].convertToLocalYYYYMMDDHHMM().substr(0,8);
		if(theDay != lastDay) {
			var ul = document.createElement(&quot;ul&quot;);
			addClass(ul,&quot;timeline&quot;);
			place.appendChild(ul);
			createTiddlyElement(ul,&quot;li&quot;,null,&quot;listTitle&quot;,tiddler[field].formatString(dateFormat));
			lastDay = theDay;
		}
		createTiddlyElement(ul,&quot;li&quot;,null,&quot;listLink&quot;).appendChild(elnbCreateTiddlyLink(place,tiddler.title,true));
	}
},    

oldHandler : null,    
};    

config.macros.elnbTimeline.oldHandler = config.macros.timeline.handler;    
config.macros.timeline.handler = config.macros.elnbTimeline.handler;    
//}}}</pre>
</div>
<div title="elnbPackage - UpgradeCore Plugin" modifier="dger" created="201102051306" modified="201102061002" tags="%tw-elnb plugin systemConfig %TBD">
<pre>/***
***/
//{{{

if( !version.extensions.elnb)
       version.extensions.elnb = {};

version.extensions.elnb.upgradeCore = {major: 1, minor: 0, revision: 0, date: new Date(2011,2,6)};  

//--
//
//--

// The TW-eLNB core
var coreConn = config.extensions.elnb.elnbCore;

config.macros.elnbUpgrade = {

        serverType: coreConn.serverType,
        serverHost: coreConn.serverHost,
        coreFile: coreConn.coreHost,
	readOnlyWarning: &quot;You cannot import into a read-only TiddlyWiki file. Try opening it from a file:// URL&quot;,
	wizardTitle: &quot;Upgrade TW-eLNB core code&quot;,
	step1Title: &quot;Update or repair this TiddlyWiki to the latest release&quot;,
	step1Html: &quot;Specify the type of the server: &lt;select name='selTypes'&gt;&lt;option value=''&gt;Choose...&lt;/option&gt;&lt;/select&gt;&lt;br&gt;Enter the URL or pathname here: &lt;input type='text' size=50 name='txtPath'&gt;&lt;br&gt;...or browse for a file: &lt;input type='file' size=50 name='txtBrowse'&gt;&lt;br&gt;&lt;hr&gt;...or select a pre-defined feed: &lt;select name='selFeeds'&gt;&lt;option value=''&gt;Choose...&lt;/option&gt;&lt;/select&gt;&quot;,
	openLabel: &quot;open&quot;,
	openPrompt: &quot;Open the connection to this file or server&quot;,
	statusOpenHost: &quot;Opening the host&quot;,
	statusGetWorkspaceList: &quot;Getting the list of available workspaces&quot;,
	step2Title: &quot;Step 2: Choose the workspace&quot;,
	step2Html: &quot;Enter a workspace name: &lt;input type='text' size=50 name='txtWorkspace'&gt;&lt;br&gt;...or select a workspace: &lt;select name='selWorkspace'&gt;&lt;option value=''&gt;Choose...&lt;/option&gt;&lt;/select&gt;&quot;,
	cancelLabel: &quot;cancel&quot;,
	cancelPrompt: &quot;Cancel this import&quot;,
	statusOpenWorkspace: &quot;Opening the workspace&quot;,
	statusGetTiddlerList: &quot;Getting the list of available tiddlers&quot;,
	errorGettingTiddlerList: &quot;Error getting list of tiddlers, click Cancel to try again&quot;,
	step3Title: &quot;Step 3: Choose the tiddlers to import&quot;,
	step3Html: &quot;&lt;input type='hidden' name='markList'&gt;&lt;/input&gt;&lt;br&gt;&lt;input type='checkbox' checked='true' name='chkSync'&gt;Keep these tiddlers linked to this server so that you can synchronise subsequent changes&lt;/input&gt;&lt;br&gt;&lt;input type='checkbox' name='chkSave'&gt;Save the details of this server in a 'systemServer' tiddler called:&lt;/input&gt; &lt;input type='text' size=25 name='txtSaveTiddler'&gt;&quot;,
	importLabel: &quot;import&quot;,
	importPrompt: &quot;Import these tiddlers&quot;,
	confirmOverwriteText: &quot;Are you sure you want to overwrite these tiddlers:\n\n%0&quot;,
	step4Title: &quot;Step 4: Importing %0 tiddler(s)&quot;,
	step4Html: &quot;&lt;input type='hidden' name='markReport'&gt;&lt;/input&gt;&quot;, // DO NOT TRANSLATE
	doneLabel: &quot;done&quot;,
	donePrompt: &quot;Close this wizard&quot;,
	statusDoingImport: &quot;Importing tiddlers&quot;,
	statusDoneImport: &quot;All tiddlers imported&quot;,
	systemServerNamePattern: &quot;%2 on %1&quot;,
	systemServerNamePatternNoWorkspace: &quot;%1&quot;,
	confirmOverwriteSaveTiddler: &quot;The tiddler '%0' already exists. Click 'OK' to overwrite it with the details of this server, or 'Cancel' to leave it unchanged&quot;,
	serverSaveTemplate: &quot;|''Type:''|%0|\n|''URL:''|%1|\n|''Workspace:''|%2|\n\nThis tiddler was automatically created to record the details of this server&quot;,
	serverSaveModifier: &quot;(System)&quot;,
	listViewTemplate: {
		columns: [
			{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'},
			{name: 'Tiddler', field: 'tiddler', title: &quot;Tiddler&quot;, type: 'Tiddler'},
			{name: 'Size', field: 'size', tiddlerLink: 'size', title: &quot;Size&quot;, type: 'Size'},
			{name: 'Tags', field: 'tags', title: &quot;Tags&quot;, type: 'Tags'}
			],
		rowClasses: [
			]}
	};

//--
//-- UpgradeCore macro
//--

config.macros.elnbUpgrade.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	if(readOnly) {
		createTiddlyElement(place,&quot;div&quot;,null,&quot;marked&quot;,this.readOnlyWarning);
		return;
	}
	var w = new Wizard();
	w.createWizard(place,this.wizardTitle);
	this.restart(w);
};

config.macros.elnbUpgrade.onCancel = function(e)
{
	var wizard = new Wizard(this);
	var place = wizard.clear();
	config.macros.elnbUpgrade.restart(wizard);
	return false;
};

config.macros.elnbUpgrade.onClose = function(e)
{
	backstage.hidePanel();
	return false;
};

config.macros.elnbUpgrade.restart = function(wizard)
{
	var me = config.macros.elnbUpgrade;
	wizard.addStep(this.step1Title,this.step1Html);
	var s = wizard.getElement(&quot;selTypes&quot;);
	for(var t in config.adaptors) {
		var e = createTiddlyElement(s,&quot;option&quot;,null,null,config.adaptors[t].serverLabel ? config.adaptors[t].serverLabel : t);
		e.value = t;
	}
	if(config.defaultAdaptor)
		s.value = config.defaultAdaptor;
	s = wizard.getElement(&quot;selFeeds&quot;);
	var feeds = this.getFeeds();
	for(t in feeds) {
		e = createTiddlyElement(s,&quot;option&quot;,null,null,t);
		e.value = t;
	}
	wizard.setValue(&quot;feeds&quot;,feeds);
	s.onchange = me.onFeedChange;
	var fileInput = wizard.getElement(&quot;txtBrowse&quot;);
	fileInput.onchange = me.onBrowseChange;
	fileInput.onkeyup = me.onBrowseChange;
	wizard.setButtons([{caption: this.openLabel, tooltip: this.openPrompt, onClick: me.onOpen}]);

        // Add path to TW-eLNB code
        var fileInput = wizard.getElement(&quot;txtPath&quot;);
        fileInput.value = this.coreFile;

	wizard.formElem.action = &quot;javascript:;&quot;;
	wizard.formElem.onsubmit = function() {
		if(!this.txtPath || this.txtPath.value.length) //# check for manually entered path in first step
			this.lastChild.firstChild.onclick();
	};
};

config.macros.elnbUpgrade.getFeeds = function()
{
	var feeds = {};
	var tagged = store.getTaggedTiddlers(&quot;systemServer&quot;,&quot;title&quot;);
	for(var t=0; t&lt;tagged.length; t++) {
		var title = tagged[t].title;
		var serverType = store.getTiddlerSlice(title,&quot;Type&quot;);
		if(!serverType)
			serverType = &quot;file&quot;;
		feeds[title] = {title: title,
						url: store.getTiddlerSlice(title,&quot;URL&quot;),
						workspace: store.getTiddlerSlice(title,&quot;Workspace&quot;),
						workspaceList: store.getTiddlerSlice(title,&quot;WorkspaceList&quot;),
						tiddlerFilter: store.getTiddlerSlice(title,&quot;TiddlerFilter&quot;),
						serverType: serverType,
						description: store.getTiddlerSlice(title,&quot;Description&quot;)};
	}
	return feeds;
};

config.macros.elnbUpgrade.onFeedChange = function(e)
{
	var wizard = new Wizard(this);
	var selTypes = wizard.getElement(&quot;selTypes&quot;);
	var fileInput = wizard.getElement(&quot;txtPath&quot;);
	var feeds = wizard.getValue(&quot;feeds&quot;);
	var f = feeds[this.value];
	if(f) {
		selTypes.value = f.serverType;
		fileInput.value = f.url;
		wizard.setValue(&quot;feedName&quot;,f.serverType);
		wizard.setValue(&quot;feedHost&quot;,f.url);
		wizard.setValue(&quot;feedWorkspace&quot;,f.workspace);
		wizard.setValue(&quot;feedWorkspaceList&quot;,f.workspaceList);
		wizard.setValue(&quot;feedTiddlerFilter&quot;,f.tiddlerFilter);
	}
	return false;
};

config.macros.elnbUpgrade.onBrowseChange = function(e)
{
	var wizard = new Wizard(this);
	if(this.files &amp;&amp; this.files[0]) {
		try {
			netscape.security.PrivilegeManager.enablePrivilege(&quot;UniversalFileRead&quot;);
		} catch (ex) {
			showException(ex);
		}
	}
	var fileInput = wizard.getElement(&quot;txtPath&quot;);
	fileInput.value = config.macros.elnbUpgrade.getURLFromLocalPath(this.value);
	var serverType = wizard.getElement(&quot;selTypes&quot;);
	serverType.value = &quot;file&quot;;
	return true;
};

config.macros.elnbUpgrade.getURLFromLocalPath = function(v)
{
	if(!v || !v.length)
		return v;
	v = v.replace(/\\/g,&quot;/&quot;); // use &quot;/&quot; for cross-platform consistency
	var u;
	var t = v.split(&quot;:&quot;);
	var p = t[1] || t[0]; // remove drive letter (if any)
	if(t[1] &amp;&amp; (t[0] == &quot;http&quot; || t[0] == &quot;https&quot; || t[0] == &quot;file&quot;)) {
		u = v;
	} else if(p.substr(0,1)==&quot;/&quot;) {
		u = document.location.protocol + &quot;//&quot; + document.location.hostname + (t[1] ? &quot;/&quot; : &quot;&quot;) + v;
	} else {
		var c = document.location.href.replace(/\\/g,&quot;/&quot;);
		var pos = c.lastIndexOf(&quot;/&quot;);
		if(pos!=-1)
			c = c.substr(0,pos); // remove filename
		u = c + &quot;/&quot; + p;
	}
	return u;
};

config.macros.elnbUpgrade.onOpen = function(e)
{
	var me = config.macros.elnbUpgrade;
	var wizard = new Wizard(this);
	var fileInput = wizard.getElement(&quot;txtPath&quot;);
	var url = fileInput.value;
	var serverType = wizard.getElement(&quot;selTypes&quot;).value || config.defaultAdaptor;
	var adaptor = new config.adaptors[serverType]();
	wizard.setValue(&quot;adaptor&quot;,adaptor);
	wizard.setValue(&quot;serverType&quot;,serverType);
	wizard.setValue(&quot;host&quot;,url);
	var ret = adaptor.openHost(url,null,wizard,me.onOpenHost);
	if(ret !== true)
		displayMessage(ret);
	wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenHost);
	return false;
};

config.macros.elnbUpgrade.onOpenHost = function(context,wizard)
{
	var me = config.macros.elnbUpgrade;
	var adaptor = wizard.getValue(&quot;adaptor&quot;);
	if(context.status !== true)
		displayMessage(&quot;Error in elnbSync.onOpenHost: &quot; + context.statusText);
	var ret = adaptor.getWorkspaceList(context,wizard,me.onGetWorkspaceList);
	if(ret !== true)
		displayMessage(ret);
	wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusGetWorkspaceList);
};

config.macros.elnbUpgrade.onGetWorkspaceList = function(context,wizard)
{
	var me = config.macros.elnbUpgrade;
	if(context.status !== true)
		displayMessage(&quot;Error in elnbSync.onGetWorkspaceList: &quot; + context.statusText);
	wizard.setValue(&quot;context&quot;,context);
	var workspace = wizard.getValue(&quot;feedWorkspace&quot;);
	if(!workspace &amp;&amp; context.workspaces.length==1)
		workspace = context.workspaces[0].title;
	if(workspace) {
		var ret = context.adaptor.openWorkspace(workspace,context,wizard,me.onOpenWorkspace);
		if(ret !== true)
			displayMessage(ret);
		wizard.setValue(&quot;workspace&quot;,workspace);
		wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenWorkspace);
		return;
	}
	wizard.addStep(me.step2Title,me.step2Html);
	var s = wizard.getElement(&quot;selWorkspace&quot;);
	s.onchange = me.onWorkspaceChange;
	for(var t=0; t&lt;context.workspaces.length; t++) {
		var e = createTiddlyElement(s,&quot;option&quot;,null,null,context.workspaces[t].title);
		e.value = context.workspaces[t].title;
	}
	var workspaceList = wizard.getValue(&quot;feedWorkspaceList&quot;);
	if(workspaceList) {
		var list = workspaceList.parseParams(&quot;workspace&quot;,null,false,true);
		for(var n=1; n&lt;list.length; n++) {
			if(context.workspaces.findByField(&quot;title&quot;,list[n].value) == null) {
				e = createTiddlyElement(s,&quot;option&quot;,null,null,list[n].value);
				e.value = list[n].value;
			}
		}
	}
	if(workspace) {
		t = wizard.getElement(&quot;txtWorkspace&quot;);
		t.value = workspace;
	}
	wizard.setButtons([{caption: me.openLabel, tooltip: me.openPrompt, onClick: me.onChooseWorkspace}]);
};

config.macros.elnbUpgrade.onWorkspaceChange = function(e)
{
	var wizard = new Wizard(this);
	var t = wizard.getElement(&quot;txtWorkspace&quot;);
	t.value = this.value;
	this.selectedIndex = 0;
	return false;
};

config.macros.elnbUpgrade.onChooseWorkspace = function(e)
{
	var me = config.macros.elnbUpgrade;
	var wizard = new Wizard(this);
	var adaptor = wizard.getValue(&quot;adaptor&quot;);
	var workspace = wizard.getElement(&quot;txtWorkspace&quot;).value;
	wizard.setValue(&quot;workspace&quot;,workspace);
	var context = wizard.getValue(&quot;context&quot;);
	var ret = adaptor.openWorkspace(workspace,context,wizard,me.onOpenWorkspace);
	if(ret !== true)
		displayMessage(ret);
	wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenWorkspace);
	return false;
};

config.macros.elnbUpgrade.onOpenWorkspace = function(context,wizard)
{
	var me = config.macros.elnbUpgrade;
	if(context.status !== true)
		displayMessage(&quot;Error in elnbSync.onOpenWorkspace: &quot; + context.statusText);
	var adaptor = wizard.getValue(&quot;adaptor&quot;);
	var ret = adaptor.getTiddlerList(context,wizard,me.onGetTiddlerList,wizard.getValue(&quot;feedTiddlerFilter&quot;));
	if(ret !== true)
		displayMessage(ret);
	wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusGetTiddlerList);
};

config.macros.elnbUpgrade.onGetTiddlerList = function(context,wizard)
{
	var me = config.macros.elnbUpgrade;
	if(context.status !== true) {
		wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.errorGettingTiddlerList);
		return;
	}
	// Extract data for the listview
	var listedTiddlers = [];
	if(context.tiddlers) {
		for(var n=0; n&lt;context.tiddlers.length; n++) {
			var tiddler = context.tiddlers[n];
			listedTiddlers.push({
				title: tiddler.title,
				modified: tiddler.modified,
				modifier: tiddler.modifier,
				text: tiddler.text ? wikifyPlainText(tiddler.text,100) : &quot;&quot;,
				tags: tiddler.tags,
				size: tiddler.text ? tiddler.text.length : 0,
				tiddler: tiddler
			});
		}
	}
	listedTiddlers.sort(function(a,b) {return a.title &lt; b.title ? -1 : (a.title == b.title ? 0 : +1);});
	// Display the listview
	wizard.addStep(me.step3Title,me.step3Html);
	var markList = wizard.getElement(&quot;markList&quot;);
	var listWrapper = document.createElement(&quot;div&quot;);
	markList.parentNode.insertBefore(listWrapper,markList);
	var listView = ListView.create(listWrapper,listedTiddlers,me.listViewTemplate);
	wizard.setValue(&quot;listView&quot;,listView);
	wizard.setValue(&quot;context&quot;,context);
	var txtSaveTiddler = wizard.getElement(&quot;txtSaveTiddler&quot;);
	txtSaveTiddler.value = me.generateSystemServerName(wizard);
	wizard.setButtons([
			{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel},
			{caption: me.importLabel, tooltip: me.importPrompt, onClick: me.doImport}
		]);
};

config.macros.elnbUpgrade.generateSystemServerName = function(wizard)
{
	var serverType = wizard.getValue(&quot;serverType&quot;);
	var host = wizard.getValue(&quot;host&quot;);
	var workspace = wizard.getValue(&quot;workspace&quot;);
	var pattern = config.macros.elnbUpgrade[workspace ? &quot;systemServerNamePattern&quot; : &quot;systemServerNamePatternNoWorkspace&quot;];
	return pattern.format([serverType,host,workspace]);
};

config.macros.elnbUpgrade.saveServerTiddler = function(wizard)
{
	var me = config.macros.elnbUpgrade;
	var txtSaveTiddler = wizard.getElement(&quot;txtSaveTiddler&quot;).value;
	if(store.tiddlerExists(txtSaveTiddler)) {
		if(!confirm(me.confirmOverwriteSaveTiddler.format([txtSaveTiddler])))
			return;
		store.suspendNotifications();
		store.removeTiddler(txtSaveTiddler);
		store.resumeNotifications();
	}
	var serverType = wizard.getValue(&quot;serverType&quot;);
	var host = wizard.getValue(&quot;host&quot;);
	var workspace = wizard.getValue(&quot;workspace&quot;);
	var text = me.serverSaveTemplate.format([serverType,host,workspace]);
	store.saveTiddler(txtSaveTiddler,txtSaveTiddler,text,me.serverSaveModifier,new Date(),[&quot;systemServer&quot;]);
};

config.macros.elnbUpgrade.doImport = function(e)
{
	var me = config.macros.elnbUpgrade;
	var wizard = new Wizard(this);
	if(wizard.getElement(&quot;chkSave&quot;).checked)
		me.saveServerTiddler(wizard);
	var chkSync = wizard.getElement(&quot;chkSync&quot;).checked;
	wizard.setValue(&quot;sync&quot;,chkSync);
	var listView = wizard.getValue(&quot;listView&quot;);
	var rowNames = ListView.getSelectedRows(listView);
	var adaptor = wizard.getValue(&quot;adaptor&quot;);
	var overwrite = [];
	var t;
	for(t=0; t&lt;rowNames.length; t++) {
		if(store.tiddlerExists(rowNames[t]))
			overwrite.push(rowNames[t]);
	}
	if(overwrite.length &gt; 0) {
		if(!confirm(me.confirmOverwriteText.format([overwrite.join(&quot;, &quot;)])))
			return false;
	}
	wizard.addStep(me.step4Title.format([rowNames.length]),me.step4Html);
	for(t=0; t&lt;rowNames.length; t++) {
		var link = document.createElement(&quot;div&quot;);
		createTiddlyLink(link,rowNames[t],true);
		var place = wizard.getElement(&quot;markReport&quot;);
		place.parentNode.insertBefore(link,place);
	}
	wizard.setValue(&quot;remainingImports&quot;,rowNames.length);
	wizard.setButtons([
			{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}
		],me.statusDoingImport);
	var wizardContext = wizard.getValue(&quot;context&quot;);
	var tiddlers = wizardContext ? wizardContext.tiddlers : [];
	for(t=0; t&lt;rowNames.length; t++) {
		var context = {
			allowSynchronous:true,
			tiddler:tiddlers[tiddlers.findByField(&quot;title&quot;,rowNames[t])]
		};
		adaptor.getTiddler(rowNames[t],context,wizard,me.onGetTiddler);
	}
	return false;
};

config.macros.elnbUpgrade.onGetTiddler = function(context,wizard)
{
	var me = config.macros.elnbUpgrade;
	if(!context.status)
		displayMessage(&quot;Error in elnbSync.onGetTiddler: &quot; + context.statusText);
	var tiddler = context.tiddler;
	store.suspendNotifications();
	store.saveTiddler(tiddler.title, tiddler.title, tiddler.text, tiddler.modifier, tiddler.modified, tiddler.tags, tiddler.fields, true, tiddler.created);
	if(!wizard.getValue(&quot;sync&quot;)) {
		store.setValue(tiddler.title,'server',null);
	}
	store.resumeNotifications();
	if(!context.isSynchronous)
		store.notify(tiddler.title,true);
	var remainingImports = wizard.getValue(&quot;remainingImports&quot;)-1;
	wizard.setValue(&quot;remainingImports&quot;,remainingImports);
	if(remainingImports == 0) {
		if(context.isSynchronous) {
			store.notifyAll();
			refreshDisplay();
		}
		wizard.setButtons([
				{caption: me.doneLabel, tooltip: me.donePrompt, onClick: me.onClose}
			],me.statusDoneImport);
		autoSaveChanges();
	}
};

//--
// Backstage tasks
//-- 

config.tasks.elnbUpgrade = {  
    text: &quot;elnbUpgrade&quot;, 
    tooltip: &quot;Upgrade TW-eLNB core code&quot;, 
    content: '&lt;&lt;elnbUpgrade&gt;&gt;'    
}  
   
config.backstageTasks.push( &quot;elnbUpgrade&quot; );  

//}}}</pre>
</div>
<div title="elnbPackage - Version" modifier="dger" created="201010031420" modified="201102050945" tags="%tw-elnb plugin systemConfig">
<pre>/***
|Name|tw-elnb Version|
|Description|Macro which returns current version.|
|Package|TW-eLNB |
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|Based on| |
|Source||
|Version|1.0.0|
|License||
|~CoreVersion||
|Type|Macro|
***/

//{{{

/* Create tw-elnb namespace */
if( !config.macros.elnb )
   config.macros.elnb = {};

/* Create macro */
config.macros.elnb.version = {
   handler: function ( place )
   {
      var version = &quot;1.0-b&quot;;
      wikify( version, place );
   }
};

/* Set macro */
config.macros.elnbVersion = config.macros.elnb.version;
//}}}</pre>
</div>
<div title="elnbPackage - elnbCreateTagButton Function" modifier="escdie" created="201011061529" modified="201011161838" tags="systemConfig %extension %tw-elnb %elnb-hack elnbPackage">
<pre>/***
|Name|elnbCreateTagButton|
|Description|Hacking 'elnbCreateTagButton' function of TW core.|
|Package|TW-eLNB |
|Version|1.0.0|
|Source||
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|License||
|~CoreVersion||
|Type|hack|
***/
//{{{
function elnbCreateTagButton(place,tag,excludeTiddler,title,tooltip)
{
	var btn = createTiddlyButton(place,title||tag,(tooltip||config.views.wikified.tag.tooltip).format([tag]),elnbOnClickTag);
	btn.setAttribute(&quot;tag&quot;,tag);
	if(excludeTiddler)
		btn.setAttribute(&quot;tiddler&quot;,excludeTiddler);
	return btn;
}
//}}}</pre>
</div>
<div title="elnbPackage - elnbCreateTiddlyLink Function" modifier="escdie" created="201011061256" modified="201011161837" tags="systemConfig %extension %tw-elnb %elnb-hack elnbPackage">
<pre>/***
|Name|elnbCreateTiddlyLink|
|Description|Hacking 'CreateTiddlyLink' function of TW core.|
|Package|TW-eLNB |
|Version|1.0.0|
|Source||
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|License||
|~CoreVersion||
|Type|hack|
***/

//{{{
function elnbCreateTiddlyLink(place,title,includeText,className,isStatic,linkedFromTiddler,noToggle)
{
	var text = includeText ? title : null;
	var i = getTiddlyLinkInfo(title,className);
    
    if(isStatic)
    {
        var btn = createExternalLink(place,store.getTiddlerText(&quot;SiteUrl&quot;,null) + &quot;#&quot; + title);
        btn.className += ' ' + className;
    }
    else
    {
        //if (text != null) 
        {
            var tiddler = [];
            var subject = undefined;
        
            tiddler = store.getTiddler( text );
            subject = store.getValue(tiddler,'subject')
            
            //if( subject == undefined &amp;&amp; subject == &quot;&quot; )
            if( subject == undefined )
                text = title;
            else 
                text = subject;
        }
        
        var btn = createTiddlyButton(place,text,i.subTitle,onClickTiddlerLink,i.classes);        
    }
	
	btn.setAttribute(&quot;refresh&quot;,&quot;link&quot;);
	btn.setAttribute(&quot;tiddlyLink&quot;,title);
    
	if(noToggle)
		btn.setAttribute(&quot;noToggle&quot;,&quot;true&quot;);
        
	if(linkedFromTiddler) 
    {
		var fields = linkedFromTiddler.getInheritedFields();
		if(fields)
			btn.setAttribute(&quot;tiddlyFields&quot;,fields);
	}
    
	return btn;
}
//}}}</pre>
</div>
<div title="elnbPackage - elnbOnClickTag Function" modifier="escdie" created="201011061213" modified="201011161844" tags="systemConfig %extension %tw-elnb %elnb-hack elnbPackage">
<pre>/***
|Name|elnbOnClickTag|
|Description|Hacking 'onClickTag' function of TW core.|
|Package|TW-eLNB |
|Version|1.0.0|
|Source||
|Author|[[dieesrod@zyzlab|http://zyzlab.dyndns.org]]|
|License||
|~CoreVersion||
|Type|hack|
***/

//{{{
function elnbOnClickTag (ev)
{
	var e = ev || window.event;
	var popup = Popup.create(this);
	addClass(popup,&quot;taggedTiddlerList&quot;);
    
	var tag = this.getAttribute(&quot;tag&quot;);
	var title = this.getAttribute(&quot;tiddler&quot;);
    
	if(popup &amp;&amp; tag) 
    {
		
        var tagged = tag.indexOf(&quot;[&quot;)==-1 ? store.getTaggedTiddlers(tag) : store.filterTiddlers(tag);
		var sortby = this.getAttribute(&quot;sortby&quot;);
		
        if(sortby&amp;&amp;sortby.length) 
        {
			store.sortTiddlers(tagged,sortby);
		}
        
		var titles = [];
		var li,r;
		for(r=0;r&lt;tagged.length;r++) 
        {
			if(tagged[r].title != title)
				titles.push(tagged[r].title);
		}
        
		var lingo = config.views.wikified.tag;
        
		if(titles.length &gt; 0) 
        {
			var openAll = createTiddlyButton(createTiddlyElement(popup,&quot;li&quot;),lingo.openAllText.format([tag]),lingo.openAllTooltip,onClickTagOpenAll);
			openAll.setAttribute(&quot;tag&quot;,tag);
			openAll.setAttribute(&quot;sortby&quot;,sortby);
			createTiddlyElement(createTiddlyElement(popup,&quot;li&quot;,null,&quot;listBreak&quot;),&quot;div&quot;);
			
            var tiddlerTitle = &quot;&quot;;           
 
            for(r=0; r&lt;titles.length; r++) 
            {
                tiddlerTitle = titles[r];
				elnbCreateTiddlyLink(createTiddlyElement(popup,&quot;li&quot;),tiddlerTitle,true);
			}
		} else 
        {
			createTiddlyElement(popup,&quot;li&quot;,null,&quot;disabled&quot;,lingo.popupNone.format([tag]));
		}    

		createTiddlyElement(createTiddlyElement(popup,&quot;li&quot;,null,&quot;listBreak&quot;),&quot;div&quot;);

		var renameTagButton = createTiddlyButton(createTiddlyElement(popup,&quot;li&quot;),(&quot;Rename tag '&quot;+tag+&quot;'&quot;),null,elnbRenameTag);
		renameTagButton.setAttribute(&quot;tag&quot;,tag)

		var h = createTiddlyLink(createTiddlyElement(popup,&quot;li&quot;),tag,false);
		createTiddlyText(h,lingo.openTag.format([tag]));

	}
    
	Popup.show();
	e.cancelBubble = true;
	if(e.stopPropagation) e.stopPropagation();
    
	return false;
}
//}}}</pre>
</div>
<div title="elnbPackage - elnbRenameTag Function" modifier="escdie" created="201011151945" modified="201011161840" tags="plugin systemConfig %tw-elnb">
<pre>/***
|''Name:''|extendRenameTag|
|''Version:''|1.0|
|''Author:''|Mike Praeuner|
|''Description:''|Provides rename tag function for tag drop down|
|''~TiddlyWiki:''|Version 2.0.8 or better|
|''Original Author:''|SaqImtiaz|
|''Original Source:''|http://tw.lewcid.org//#TaggerPlugin|
Note this plugin has been customized for this document and is a variant of the original source.
Please refer to the original plugin http://tw.lewcid.org//#TaggerPlugin for extended use.
DO NOT USE in the same document with TaggerPlugin (use one or the other)
***/
//{{{

elnbTiddlerSwapTag =  function (tiddler, oldTag, newTag){
                    for (var i = 0; i &lt; tiddler.tags.length; i++)
			  if (tiddler.tags[i] == oldTag) {
				  tiddler.tags[i] = newTag;
				  return true;}
                         return false;
}

elnbRenameTag = function(e) {
                    var tag=this.getAttribute(&quot;tag&quot;);
                    var newtag=prompt(&quot;Rename tag '&quot;+tag+&quot;' to:&quot;,tag);

                    if ((newtag==tag)||(newtag==null)) {return false;}

                    if(store.tiddlerExists(newtag))
                               {if(confirm(config.messages.overwriteWarning.format([newtag.toString()])))
                                             story.closeTiddler(newtag,false,false);
                               else
                                             return null;}

                    tagged=store.getTaggedTiddlers(tag);
                    if (tagged.length!=0){
                          for (var j = 0; j &lt; tagged.length; j++)
                              elnbTiddlerSwapTag(tagged[j],tag,newtag);}

                    if (store.tiddlerExists(tag))
                       {store.saveTiddler(tag,newtag);}
                    if (document.getElementById(&quot;tiddler&quot;+tag))
                       {var oldTagTiddler =  document.getElementById(story.idPrefix + tag);
                       var before= story.positionTiddler(oldTagTiddler);
                       var place = document.getElementById(story.container);
                       story.closeTiddler(tag,false,false);
                       story.createTiddler(place,before,newtag,null);
                       story.saveTiddler(newtag);}
                    if(config.options.chkAutoSave)
                                                      saveChanges();
                    return false;
}
//}}}</pre>
</div>
<div title="zz_elnbPackageConfig" modifier="escdie" created="201009171728" modified="201011221103" tags="systemConfig %tw-elnb elnbExtension">
<pre>/***
|Description:|Configuration of TW-eLNB package|

!Plugins
!!!BackupOptions plugin
***/
//{{{
config.options[&quot;txtBackupFolder&quot;] = &quot;backups&quot;;
config.options[&quot;txtBackupOptionsFormat&quot;]=&quot;%N_-_%Y-%M_BAK.html&quot;;  
//}}}
/***
!!!DisableWikiLinks plugin
***/
//{{{
config.options[&quot;chkDisableWikiLinks&quot;] = true;
//}}}
/***
!!!HTMLFormatting plugin
***/
//{{{
config.options[&quot;chkHTMLHideLinebreaks&quot;] = true;
//}}}
/***
!!!SaveCookie plugin
***/
//{{{
config.options[&quot;chkPortableCookies&quot;]  = false;
config.options[&quot;chkMonitorCookieJar&quot;] = true;  
//}}}
/***
!TW-eLNB package

!!!General
***/
//{{{
config.options.elnbTW = { timeLog: true, pomodoro: false  };
//}}}
/***
!!!TiddlersBar plugin
***/
//{{{
/*config.options[&quot;txtSelectedTiddlerTabButton&quot;] = null;*/
//}}}
/***
!!!CategoryTemplate plugin
***/

</pre>
</div>
<div title="zzz_UserConfig" modifier="escdie" created="201009180558" modified="201102181827" tags="systemConfig">
<pre>/***
|Description:| A place to put your configuration |
***/

/***
!!!General
***/

//{{{
config.options.txtUserName = &quot;escdie&quot;;
//}}}

/***
!!!Read only mode 
***/

//{{{
config.options.chkHttpReadOnly = false;
readOnly = false;
showBackstage = true;
//}}}</pre>
</div>
<div title="#cancelled" modifier="escdie" created="201103221250" modified="201103221306" tags="%TaskStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="#closed" modifier="escdie" created="201103221259" tags="%QuestionStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="#done" modifier="escdie" created="201103221259" modified="201103221307" tags="%TaskStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="#future" modifier="escdie" created="201103221252" tags="%TaskStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="#next" modifier="escdie" created="201103221252" tags="%TaskStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="#now" modifier="escdie" created="201103221251" tags="%TaskStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="#ongoing" modifier="escdie" created="201103221252" tags="%TaskStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="#open" modifier="escdie" created="201103221250" tags="%QuestionStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="#waitingFor" modifier="escdie" created="201103280756" tags="%TaskStatusDB" creator="escdie">
<pre></pre>
</div>
<div title="&amp;analysis" modifier="escdie" created="201105241709" tags="%PrjWorkTypeDB" creator="escdie">
<pre>Type the text for 'New Tiddler'</pre>
</div>
<div title="&amp;design" modifier="escdie" created="201103280751" tags="%PrjWorkTypeDB" creator="escdie">
<pre></pre>
</div>
<div title="&amp;development" modifier="escdie" created="201105241710" tags="%PrjWorkTypeDB" creator="escdie">
<pre></pre>
</div>
<div title="&amp;problem" modifier="escdie" created="201105241707" tags="%PrjWorkTypeDB" creator="escdie">
<pre></pre>
</div>
<div title="&amp;review" modifier="escdie" created="201103280752" tags="%PrjWorkTypeDB" creator="escdie">
<pre></pre>
</div>
<div title="&amp;simulation" modifier="escdie" created="201103280752" tags="%PrjWorkTypeDB" creator="escdie">
<pre></pre>
</div>
<div title="&amp;specs" modifier="escdie" created="201103280751" tags="%PrjWorkTypeDB" creator="escdie">
<pre></pre>
</div>
<div title="&amp;test" modifier="escdie" created="201103280753" tags="%PrjWorkTypeDB" creator="escdie">
<pre></pre>
</div>
<div title="?askFor" modifier="escdie" created="201105050612" tags="%ActionDB" creator="escdie">
<pre>Type the text for '?askFor'</pre>
</div>
<div title="?discussion" modifier="escdie" created="201104280647" tags="%ActionDB" creator="escdie">
<pre></pre>
</div>
<div title="?readRef" modifier="dger" created="201105010630" modified="201105010635" tags="%ActionDB" creator="dger">
<pre>Type the text for '?readRef'</pre>
</div>
<div title="?request" modifier="escdie" created="201106190654" tags="%ActionDB" creator="escdie">
<pre>Type the text for '?request'</pre>
</div>
<div title="?searchInfo" modifier="escdie" created="201107230645" tags="%ActionDB" creator="escdie">
<pre>Type the text for 'New Tiddler'</pre>
</div>
<div title="?thinkAbout" modifier="escdie" created="201104261011" tags="%ActionDB" creator="escdie">
<pre></pre>
</div>
<div title="?writeDoc" modifier="escdie" created="201104281512" tags="%ActionDB" creator="escdie">
<pre></pre>
</div>
<div title="About" modifier="escdie" created="201009141800" modified="201107040651" tags="systemTiddler %tw-elnb %help">
<pre>!TiddlyWik eLB
TW-eLB is a tuning version of [[TiddlyWiki|http://tiddlywiki.com]], a list of TW extensions used and/or modified are listed below. 
The current version of TW-eLNB is ''v&lt;&lt;elnbVersion&gt;&gt;'' an it is based on version ''v&lt;&lt;version&gt;&gt;'' of TW.

| Layout | Styles | Templates | Extensions |
|&lt;&lt;list filter &quot;[tag[%tw-elnb AND systemTiddler]]&quot;&gt;&gt;|&lt;&lt;list filter &quot;[tag[%tw-elnb AND styleTiddler]]&quot;&gt;&gt;|&lt;&lt;list filter &quot;[tag[%tw-elnb AND templateTiddler]]&quot;&gt;&gt;|&lt;&lt;list filter &quot;[tag[%tw-elnb AND plugin]]&quot;&gt;&gt;|

Open issues and wishes can be found [[here|elnbPackage - ToBeDone]].

!!!License
Copyright [[XYZ Lab.|http://xyz-lab.org.es]] 2010

''Open Source Licence''
This page (and the TiddlyWiki it is building on) is published under a [[BSD open source license|http://www.linfo.org/bsdlicense.html]]. This gives you the freedom to use it pretty much however you want, including for commercial purposes, as long as you keep the copyright notice.

!!!Version
* 1.0  (Oct' 2010) - Initial beta version
</pre>
</div>
<div title="Activities" modifier="escdie" created="201010251632" modified="201208060720" tags="%tw-elnb systemTiddler">
<pre>&lt;&lt;list filter [tag[@activity]]&gt;&gt;
</pre>
</div>
<div title="Attachements" modifier="escdie" created="201010180703" modified="201101100817" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;list filter [tag[@attachment]]&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;

</pre>
</div>
<div title="Calendar" modifier="escdie" created="201009181059" modified="201202021014" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;calendar thismonth&gt;&gt;
&lt;&lt;newReminder&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;
!!Upcoming events
&lt;&lt;showReminders leadtime:30 format:&quot;DATE -- TITLE -- TIDDLER&quot;&gt;&gt;
!!All events
</pre>
</div>
<div title="ColorPalette" modifier="escdie" created="201011160749" modified="201011160751" tags="styleTiddler">
<pre>Background: #fff
Foreground: #000
PrimaryPale: #cfb3d6
PrimaryLight: #aa78b6
PrimaryMid: #7d4989
PrimaryDark: #100912
SecondaryPale: #b3d6c8
SecondaryLight: #78b69c
SecondaryMid: #49896f
SecondaryDark: #09120f
TertiaryPale: #d6d6b3
TertiaryLight: #b5b678
TertiaryMid: #888949
TertiaryDark: #121209
Error: #f88
</pre>
</div>
<div title="Configuration" modifier="escdie" created="201008280728" modified="201011101919" tags="systemTiddler %tw-elnb">
<pre>!!! Layout
[[PageTemplate]]
|&gt;|&gt;|[[SiteTitle]] - [[SiteSubtitle]]|
| [[MainMenu]] | [[DefaultTiddlers]]&lt;br&gt;&lt;br&gt;[[ViewTemplate]]&lt;br&gt;&lt;br&gt;[[EditTemplate]] |[[SideBarOptions]] |
|~|~|[[OptionsPanel]] |
|~|~|[[AdvancedOptions]] |
|~|~|&lt;&lt;tiddler Configuration.SideBarTabs&gt;&gt; |
*Basic StyleSheet: [[StyleSheetColors]] - [[StyleSheetLayout]] - [[StyleSheetPrint]]
*[[SiteUrl]]
!!!Styles
&lt;&lt;list filter &quot;[tag[styleTiddler]]&gt;&gt;
!!!Templates
&lt;&lt;list filter &quot;[tag[templateTiddler]]&gt;&gt;
!!!Plugins
&lt;&lt;list filter &quot;[tag[pluginConfig]]&quot;&gt;&gt;</pre>
</div>
<div title="Dashboard" modifier="escdie" created="201008301646" modified="201206210805" tags="systemTiddler %tw-elnb">
<pre>Click to see a &lt;&lt;randomTiddler &quot;systemConfig&quot; &quot;%tw-elnb&quot;&gt;&gt; tiddler or the [[cloud of tags|TagCloud]].
!To-do
&lt;&lt;tabs txtToDoPanel
Now &quot; &quot; ToDoNow
Next &quot;&quot; ToDoNext
WaitingFor &quot;&quot; ToDoWaitingFor
Future/Maybe &quot; &quot; ToDoFuture&gt;&gt;
!!!Ongoing
&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot; &amp;&amp; 
      tiddler.tags.contains(&quot;#ongoing&quot;)'
      sortBy 'tiddler.created' descending
      write &quot;'* [[' +store.getTiddlerSubject(tiddler)+ '|'+tiddler.title+']]\n'&quot;&gt;&gt;
!!!Open Questions 
&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;question&quot; &amp;&amp; 
      tiddler.tags.contains(&quot;#open&quot;)'
      sortBy 'tiddler.created' descending
      write &quot;'* [[' +store.getTiddlerSubject(tiddler)+ '|'+tiddler.title+']] ('+ tiddler.created.formatString('YYYY-0MM-0DD') + ')\n' &quot;&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;

</pre>
</div>
<div title="DashboardViewTemplate" modifier="dger" created="201008301646" modified="201010240812" tags="templateTiddler %tw-elnb" template="Dashboard">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;)&lt;/div&gt;
&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='view category'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;
&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;div class='newReminder' macro='newReminder'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="DatePluginInfo" modifier="dger" created="201007171405" modified="201009271801" tags="pluginInfo plugin %tw-elnb DateExtension">
<pre>|Name|DatePluginInfo|
|Source|http://www.TiddlyTools.com/#DatePlugin|
|Documentation|http://www.TiddlyTools.com/#DatePluginInfo|
|Version|2.7.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|documentation|
|Description|documentation for DatePlugin|
This plugin provides a general approach to displaying formatted dates and/or links and popups that permit easy navigation and management of tiddlers based on their creation/modification dates.
!!!!!Usage
&lt;&lt;&lt;
This plugin displays formatted dates, for the specified year, month, day using number values or mathematical expressions such as (Y+1) or (D+30).  Optionally, you can create a link to a 'dated tiddler' for quick blogging or create a popup menu that includes the dated tiddler link plus links to tiddlers that were created/changed on that date, or are tagged with that date and, if the RemindersPlugin is installed, any pending reminders for the coming 31 days.  There is also a public API, so other plugins can embed a variety of formatted date output, links, and/or popup menus.
{{{
&lt;&lt;date mode date format linkformat&gt;&gt;
}}}
//all parameters are optional//
*''mode''&lt;br&gt;is one of:
**''display'' (default)&lt;br&gt;shows a formatted date
**''link''&lt;br&gt;creates a link to a specific 'date titled' tiddler
**''popup''&lt;br&gt;creates a popup command containing a dated tiddler link, plus links to changes and reminders.
*''date''&lt;br&gt;lets you enter ANY date (not just today) as ''year, month, and day values or simple mathematical expressions'' using pre-defined variables, Y, M, and D for the current year, month and day, repectively.  You can display the modification date of the current tiddler by using the keyword: ''tiddler'' in place of the year, month and day parameters.  Use ''tiddler://name-of-tiddler//'' to display the modification date of a specific tiddler.  You can also use keywords ''today'' or ''filedate'' to refer to these //dynamically changing// date/time values.  
*{{block{
''format'' and ''linkformat''
uses standard ~TiddlyWiki date formatting syntax.  The default is &quot;YYYY.0MM.0DD&quot;
&gt;''DDD'' - day of week in full (eg, &quot;Monday&quot;), ''DD'' - day of month, ''0DD'' - adds leading zero
&gt;''MMM'' - month in full (eg, &quot;July&quot;), ''MM'' - month number, ''0MM'' - adds leading zero
&gt;''YYYY'' - full year, ''YY'' - two digit year, ''hh'' - hours, ''mm'' - minutes, ''ss'' - seconds
&gt;//note: use of hh, mm or ss format codes is only supported with ''tiddler'', ''today'' or ''filedate'' values//
}}}
*''linkformat''&lt;br&gt;specify an alternative date format so that the title of a 'dated tiddler' link can have a format that differs from the date's displayed format
In addition to the macro syntax, DatePlugin also provides a public javascript API so that other plugins that work with dates (such as calendar generators, etc.) can quickly incorporate date formatted links or popups into their output:
{{{
showDate(place, date, mode, format, linkformat, autostyle, weekend);
}}} 
Note that the javascript API supports two //optional// true/false parameters, in addition those provided by the macro interface:
*''autostyle''&lt;br&gt;font/background styles of formatted dates are automatically adjusted to show the date's status:  'today' is boxed, 'changes' are bold, 'reminders' are underlined, weekends, holidays, changes, and reminders each have a different background color to make them more visibly distinct from one another.
*''weekend''&lt;br&gt;true=day is a weekend, false=day is a weekday, default=automatically determine if a given date falls on a weekend.
&lt;&lt;&lt;
!!!!!Examples
&lt;&lt;&lt;
The current date: &lt;&lt;date&gt;&gt;
The current time: &lt;&lt;date today &quot;0hh:0mm:0ss&quot;&gt;&gt;
Today's blog: &lt;&lt;date link today &quot;DDD, MMM DDth, YYYY&quot;&gt;&gt;
Recent blogs/changes/reminders: &lt;&lt;date popup Y M D-1 &quot;yesterday&quot;&gt;&gt; &lt;&lt;date popup today &quot;today&quot;&gt;&gt; &lt;&lt;date popup Y M D+1 &quot;tomorrow&quot;&gt;&gt;
The first day of next month will be a &lt;&lt;date Y M+1 1 &quot;DDD&quot;&gt;&gt;
This tiddler (DatePlugin) was last updated on: &lt;&lt;date tiddler &quot;DDD, MMM DDth, YYYY&quot;&gt;&gt;
The SiteUrl was last updated on: &lt;&lt;date tiddler:SiteUrl &quot;DDD, MMM DDth, YYYY&quot;&gt;&gt;
This document was last saved on &lt;&lt;date filedate &quot;DDD, MMM DDth, YYYY at 0hh:0mm:0ss&quot;&gt;&gt;
&lt;&lt;date 2006 07 24 &quot;MMM DDth, YYYY&quot;&gt;&gt; will be a &lt;&lt;date 2006 07 24 &quot;DDD&quot;&gt;&gt;
&lt;&lt;&lt;
!!!!!Revisions
&lt;&lt;&lt;
2009.05.31 2.7.1 in addRemindersToPopup(), 'new reminder....' command now uses {{{&lt;&lt;newTiddler&gt;&gt;}}} macro.  Also, general code reduction/cleanup.
2008.03.08 2.7.0 in addModifiedsToPopup(), if a tiddler was created on the specified date, don't list it in the 'changed' section of the popup.  Based on a request from Kashgarinn
2008.01.31 2.6.0 refactored date style logic into separate setDateStyle() function so it can be overridden by a custom definition.  See [[DatePluginConfig]].
2008.01.11 2.5.0 added options to selectively suppress created/changes/tagged/reminders popup content 
2008.01.08 [*.*.*] plugin size reduction: documentation moved to DatePluginInfo
2007.11.21 2.4.0 added hasTagged() and addTaggedToPopup() to list any tiddlers that has been tagged using the title of the dated journal tiddler asa tag value (i.e., the tiddlers that will be listed in the standard &quot;tagging&quot; display when viewing the journal tiddler itself).  Based on a request from Coby.
2007.06.20 2.3.1 in onClickDatePopup(), use Popup.show() instead of deprecated ScrollToTiddlerPopup().  Fixes fatal error that prevents popups from being properly displayed
2007.05.31 2.3.0 list &quot;created&quot; tiddlers in date popup.  Also, force re-cache of created/modified indices when displaying current date and store.isDirty(), so that popup is kept in sync with tiddler changes.
2006.05.09 2.2.1 added &quot;todaybg&quot; handling to set background color of current date.  Also, honor excludeLists tag when getting lists of tiddlers.  Based on suggestions by Mark Hulme.
2006.05.05 2.2.0 added &quot;linkedbg&quot; handling to set background color when a 'dated tiddler' exists.  Based on a suggestion by Mark Hulme.
2006.03.08 2.1.2 add 'override leadtime' flag param in call to findTiddlersWithReminders(), and add &quot;Enter a title&quot; default text to new reminder handler.  Thanks to Jeremy Sheeley for these additional tweaks.
2006.03.06 2.1.0 hasReminders() nows uses window.reminderCacheForCalendar[] when present.  If calendar cache is not present, indexReminders() now uses findTiddlersWithReminders() with a 90-day look ahead to check for reminders.  Also, switched default background colors for autostyled dates: reminders are now greenish (&quot;c0ffee&quot;) and holidays are now reddish (&quot;ffaace&quot;).
2006.02.14 2.0.5 when readOnly is set (by TW core), omit &quot;new reminders...&quot; popup menu item and, if a &quot;dated tiddler&quot; does not already exist, display the date as simple text instead of a link.
2006.02.05 2.0.4 added var to variables that were unintentionally global.  Avoids FireFox 1.5.0.1 crash bug when referencing global variables
2006.01.18 2.0.3 In 1.2.x the tiddler editor's text area control was given an element ID=(&quot;tiddlerBody&quot;+title), so that it was easy to locate this field and programmatically modify its content.  With the addition of configuration templates in 2.x, the textarea no longer has an ID assigned.  To find this control we now look through all the child nodes of the tiddler editor to locate a &quot;textarea&quot; control where attribute(&quot;edit&quot;) equals &quot;text&quot;, and then append the new reminder to the contents of that control.
2006.01.11 2.0.2 correct 'weekend' override detection logic in showDate()
2006.01.10 2.0.1 allow custom-defined weekend days (default defined in config.macros.date.weekend[] array)
added flag param to showDate() API to override internal weekend[] array
2005.12.27 2.0.0 Update for TW2.0
Added parameter handling for 'linkformat'
2005.12.21 1.2.2 FF's date.getYear() function returns 105 (for the current year, 2005).  When calculating a date value from Y M and D expressions, the plugin adds 1900 to the returned year value get the current year number.  But IE's date.getYear() already returns 2005.  As a result, plugin calculated date values on IE were incorrect (e.g., 3905 instead of 2005).  Adding +1900 is now conditional so the values will be correct on both browsers.
2005.11.07 1.2.1 added support for &quot;tiddler&quot; dynamic date parameter
2005.11.06 1.2.0 added support for &quot;tiddler:title&quot; dynamic date parameter
2005.11.03 1.1.2 when a reminder doesn't have a specified title parameter, use the title of the tiddler that contains the reminder as &quot;fallback&quot; text in the popup menu.  Based on a suggestion from BenjaminKudria.
2005.11.03 1.1.1 Temporarily bypass hasReminders() logic to avoid excessive overhead from generating the indexReminders() cache.  While reminders can still appear in the popup menu, they just won't be indicated by auto-styling the date number that is displayed.  This single change saves approx. 60% overhead (5 second delay reduced to under 2 seconds).
2005.11.01 1.1.0 corrected logic in hasModifieds() and hasReminders() so caching of indexed modifieds and reminders is done just once, as intended.  This should hopefully speed up calendar generators and other plugins that render multiple dates...
2005.10.31 1.0.1 documentation and code cleanup
2005.10.31 1.0.0 initial public release
2005.10.30 0.9.0 pre-release
&lt;&lt;&lt;</pre>
</div>
<div title="DefaultTiddlers" modifier="escdie" created="201007171132" modified="201011110746" tags="systemTiddler %tw-elnb excludeLists">
<pre>[[Dashboard]]</pre>
</div>
<div title="Documents" modifier="escdie" created="201008251645" modified="201011110946" tags="systemTiddler %tw-elnb">
<pre>!!All documents
&lt;&lt;forEachTiddler
      where 'tiddler.tags.contains(&quot;@document&quot;)' 
      sortBy 'tiddler.title'
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
!!Notes
&lt;&lt;forEachTiddler
      where 'tiddler.tags.contains(&quot;@document&quot;) &amp;&amp;
      tiddler.tags.contains(&quot;@note&quot;)'
      sortBy 'tiddler.title'
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
!!Reports
&lt;&lt;forEachTiddler
      where 'tiddler.tags.contains(&quot;@document&quot;) &amp;&amp;
      tiddler.tags.contains(&quot;@report&quot;)'
      sortBy 'tiddler.title'
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="EditTemplate" modifier="escdie" created="201008301645" modified="201010260738" tags="templateTiddler %tw-elnb">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit title'&gt;&lt;/div&gt;
&lt;div macro='annotations'&gt;&lt;/div&gt;

&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            Subject: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit subject&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;

&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;
&lt;span macro='tagChooser excludeLists'&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            Category: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit category&quot;&gt;&lt;/span&gt;
            Template: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit template&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="File Drawer" modifier="escdie" created="201008251646" modified="201011110939" tags="systemTiddler %tw-elnb">
<pre>!!References
&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;drawer&quot;'
      sortBy 'tiddler.title'
      write &quot;'* [['+tiddler.title+'|'+tiddler.title+']]\n'&quot;&gt;&gt;

&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="FormatingInstruction" modifier="escdie" created="201009171646" modified="201102050907" tags="%tw-elnb %help">
<pre>TTiddlyWiki uses Wiki style markup, a way of lightly &quot;tagging&quot; plain text so it can be transformed into HTML. Edit this Tiddler to see samples.

! Header Samples
!Header 1
!!Header 2
!!!Header 3
!!!!Header 4
!!!!!Header 5

! Unordered Lists:
* Lists are where it's at
* Just use an asterisk and you're set
** To nest lists just add more asterisks...
***...like this
* The circle makes a great bullet because once you've printed a list you can mark off completed items
* You can also nest mixed list types
## Like this

! Ordered Lists
# Ordered lists are pretty neat too
# If you're handy with HTML and CSS you could customize the [[numbering scheme|http://www.w3schools.com/css/pr_list-style-type.asp]]
## To nest, just add more octothorpes (pound signs)...
### Like this
* You can also
** Mix list types
*** like this
# Pretty neat don't you think?

! Tiddler links
To create a Tiddler link, just use mixed-case WikiWord, or use [[brackets]] for NonWikiWordLinks. This is how the GTD style [[@Action]] lists are created. 

Note that existing Tiddlers are in bold and empty Tiddlers are in italics. See CreatingTiddlers for details.

! External Links
You can link to [[external sites|http://google.com]] with brackets. You can also LinkToFolders on your machine or network shares.

! Images
Edit this tiddler to see how it's done.
[img[http://img110.echo.cx/img110/139/gorilla8nw.jpg]]

!Tables
|!th1111111111|!th2222222222|
|&gt;| colspan |
| rowspan |left|
|~| right|
|colored| center |
|caption|c

For a complex table example, see PeriodicTable.

! Horizontal Rules
You can divide a tiddler into
----
sections by typing four dashes on a line by themselves.

! Blockquotes
&lt;&lt;&lt;
This is how you do an extended, wrapped blockquote so you don't have to put angle quotes on every line.
&lt;&lt;&lt;
&gt;level 1
&gt;level 1
&gt;&gt;level 2
&gt;&gt;level 2
&gt;&gt;&gt;level 3
&gt;&gt;&gt;level 3
&gt;&gt;level 2
&gt;level 1

! Other Formatting
''Bold''
==Strike==
__Underline__
//Italic//
Superscript: 2^^3^^=8
Subscript: a~~ij~~ = -a~~ji~~
@@highlight@@
@@color(green):green colored@@
@@bgcolor(#ff0000):color(#ffffff):red colored@@</pre>
</div>
<div title="FullScreenPageTemplate" modifier="escdie" created="201011201728" modified="201011201749" tags="%tw-elnb templateTiddler pluginConfig">
<pre>&lt;!--{{{--&gt;
&lt;div id='messageArea'&gt;&lt;/div&gt;  
&lt;div id='tiddlerDisplay'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="Help" modifier="escdie" created="201008141705" modified="201102050908" tags="systemTiddler %tw-elnb %help">
<pre>TiddlyWiki:
* [[BasicEditing]]
* [[FormatingInstruction]]
* [[TiddlyWiki official web|http://www.tiddlywiki.com]]
* [[TW Help|http://twhelp.tiddlyspot.com]]
* [[An absolute beginner's guide to TiddlyWiki|http://tiddlertoddler.tiddlyspot.com/]]
* [[Learn the Basics of TiddlyWiki | http://www.blogjones.com/TiddlyWikiTutorial.html]]
* [[Write mathematics using LaTeX|http://www.math.ist.utl.pt/~psoares/MathSVG.html]]

CSS:
* http://www.echoecho.com/csstext.htm

Extensions and more:
* [[TiddlyTools|http://www.tiddlytools.com]]
* [[TiddlyVault|http://tiddlyvault.tiddlyspot.com]]
* [[TiddlyHubVault|http://plugins.tiddlywiki.org]]

Macros:
&lt;&lt;list filter [tag[macroInfo]]&gt;&gt;
Plugins:
&lt;&lt;list filter [tag[pluginInfo]]&gt;&gt;</pre>
</div>
<div title="HideCloudTags" modifier="dger" created="201009051933" modified="201102060657" tags="systemTiddler %tw-elnb">
<pre>Trash systemConfig systemConfigDisable systemTiddler templateTiddler styleTiddler  defaultTiddler plugin pluginInfo pluginConfig macro macroInfo DiscoveryPackage NavigationPackage UdoBorkowski YourSearchExtension  wysiwyg VisualTW MediaPackage syntax lewcidExtension TaggerPlugin IconPackage IncludePlugin ImportExportPackage excludeLists excludeMissing excludeSearch ForEachTiddlerMacro ForEachTiddlerProject BookmarkPackage DiscussionPackage IFramePackage TaskPackage tool bookmarklet transclusion FieldEditorPackage SaveAsPackage ReminderPackage CookieSaverPackage IncludePackage DateExtension TagCloudExtension TrashExtension ForEachTiddlerPackage RemainderPackage YurSearchPackage elnbPackage elnbExtension ExtList AttachFilePackage excludeList #now #next #future #cancelled #done #closed #starred @diary @pomodoro @timeLog %tw-elnb %elnb-hack %extension %backup %help</pre>
</div>
<div title="Journal" modifier="escdie" created="201008251618" modified="201011110946" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;journal&quot; &amp;&amp; 
                 !( tiddler.tags.contains(&quot;@timeLog&quot;) || tiddler.tags.contains(&quot;@diary&quot;) || tiddler.tags.contains(&quot;@pomodoro&quot;) ) ' 
      sortBy 'tiddler.created' descending
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;

</pre>
</div>
<div title="JournalPageEditTemplate" modifier="escdie" created="201010180709" modified="201010260733" tags="%tw-elnb templateTiddler">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit title'&gt;&lt;/div&gt;
&lt;div macro='annotations'&gt;&lt;/div&gt;  

&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;

&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;
&lt;span macro='tagChooser excludeLists'&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div macro='annotations'&gt;&lt;/div&gt;

&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            Category: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit category&quot;&gt;&lt;/span&gt;
            Template: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit template&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="JournalPageViewTemplate" modifier="dger" created="201009301810" modified="201010031546" tags="%tw-elnb templateTiddler">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::WysiwygViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;)&lt;/div&gt;

&lt;div class='toolbar'&gt;
&lt;span macro=&quot;showWhen tiddler.tags.contains('systemConfig')&quot;&gt;
   &lt;span macro=&quot;toggleTag systemConfigDisable . 'Disable'&quot;&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;span macro=&quot;showWhen (! tiddler.tags.contains('systemConfig')  &amp;&amp; 
                       ! tiddler.tags.contains('systemTiddler') &amp;&amp; 
                       ! tiddler.tags.contains('styleTiddler')  &amp;&amp; 
                       ! tiddler.tags.contains('templateTiddler') )&quot;&gt;
   &lt;span macro=&quot;toggleTag #starred . 'Starred'&quot;&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/div&gt;

&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='view category'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;

&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="MainMenu" modifier="dger" created="201011062137" modified="201212190808" tags="%tw-elnb systemTiddler excludeLists">
<pre>&lt;&lt;elnbTodayJournal2&gt;&gt;

[[Tasks]]
[[Questions]]
[[Thoughts]]
----
[[Journal]]
[[Meetings &amp; Co.]]
[[Procedures]]
----
[[Activities]]
[[Resources]]
&lt;&lt;LaunchApplicationButton &quot;Storage&quot; &quot;Open storage directory&quot; &quot;data&quot;&gt;&gt;

^^[[TiddyWiki|http://tiddlywiki.com]] v&lt;&lt;version&gt;&gt;
TW-eLB v&lt;&lt;elnbVersion&gt;&gt;
Copyright [[XYZ Lab|http://xyz-lab.org.es]]
[[TBD|elnbPackage - ToBeDone]]^^

^^[[CookieData|CookieJar]]
[[MessageLog]]^^
</pre>
</div>
<div title="MapOfTiddlers" modifier="escdie" created="201011090839" modified="201106090752" tags="%tw-elnb systemTiddler">
<pre>&lt;&lt;tiddlytagmindmap id:example4 width:500 height:500 startState:{{[&quot;$nexRobotics&quot;]}} notagcloud:true&gt;&gt;</pre>
</div>
<div title="MarkupPreHead" modifier="escdie" created="201007080955" modified="201102181833" tags="systemTiddler %tw-elnb">
<pre>&lt;!--{{{--&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;./tw-elnb/tools/ckeditor/ckeditor.js&quot;&gt;&lt;/script&gt;
&lt;!--}}}--&gt;
</pre>
</div>
<div title="MeetingEditTemplate" modifier="escdie" created="201008301644" modified="201011081050" tags="templateTiddler %tw-elnb">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit subject'&gt;&lt;/div&gt;

&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            TID: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit title&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;

&lt;div macro='annotations'&gt;&lt;/div&gt;

&lt;div class=&quot;text&quot;&gt;Date: &lt;span class=&quot;mmEditFieldValue&quot; macro=&quot;edit date&quot;&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div class=&quot;text&quot;&gt;Time: &lt;span class=&quot;mmEditFieldValue&quot; macro=&quot;edit time&quot;&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div class=&quot;text&quot;&gt;Attendance:  &lt;span class=&quot;mmEditFieldValue&quot; macro=&quot;edit attendance&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;text&quot;&gt;Location:  &lt;span class=&quot;mmEditFieldValue&quot; macro=&quot;edit location&quot;&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div class=&quot;mmTitle&quot;&gt; Minutes &lt;/div&gt;
&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;

&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;&lt;span macro='tagChooser excludeLists'&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            Category: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit category&quot;&gt;&lt;/span&gt;
            Template: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit template&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;!--}}}--&gt;
</pre>
</div>
<div title="MeetingViewTemplate" modifier="escdie" created="201008301644" modified="201010290944" tags="templateTiddler %tw-elnb">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::WysiwygViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view subject'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;) - TID: &lt;span class=&quot;view&quot; macro=&quot;view title&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class='toolbar'&gt;
   &lt;span macro=&quot;toggleTag #starred . 'Starred'&quot;&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='view category'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;
&lt;div class=&quot;mmViewFieldName&quot;&gt;Date: &lt;span class=&quot;mmViewFieldValue&quot; macro=&quot;view date&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;mmViewFieldName&quot;&gt;Time: &lt;span class=&quot;mmViewFieldValue&quot; macro=&quot;view time&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;mmViewFieldName&quot;&gt;Attendance: &lt;span class=&quot;mmViewFieldValue&quot; macro=&quot;view attendance&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;mmViewFieldName&quot;&gt;Location: &lt;span class=&quot;mmViewFieldValue&quot; macro=&quot;view location&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;mmTitle&quot;&gt;Minutes&lt;/div&gt;
&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="Meetings &amp; Co." modifier="dger" created="201007171140" modified="201212120942" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;meeting&quot;'
      sortBy 'tiddler.created' descending
      write &quot; '* [[' +store.getTiddlerSubject(tiddler)+ '|' + tiddler.title + ']] - ' + store.getValue(tiddler,'date')+ '\n' &quot;&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="NoteEditTemplate" modifier="escdie" created="201010020935" modified="201103221346" tags="templateTiddler %tw-elnb" category="text">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'&gt;&lt;span style=&quot;padding-right:0.15em;&quot; macro='monkeyTagger label:&quot;Activity&quot; source:%ActivityDB'&gt;&lt;/div&gt;
&lt;div class='title' macro='view subject'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit subject'&gt;&lt;/div&gt;
&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            TID: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit title&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;div macro='annotations'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;
&lt;span macro='tagChooser excludeLists'&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            Category: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit category&quot;&gt;&lt;/span&gt;
            Template: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit template&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="NoteViewTemplate" modifier="escdie" created="201010020935" modified="201010251823" tags="templateTiddler %tw-elnb">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::WysiwygViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view subject'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;) - TID: &lt;span class=&quot;view&quot; macro=&quot;view title&quot;&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div class='toolbar'&gt;
&lt;span macro=&quot;showWhen tiddler.tags.contains('systemConfig')&quot;&gt;
   &lt;span macro=&quot;toggleTag systemConfigDisable . 'Disable'&quot;&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;span macro=&quot;showWhen (! tiddler.tags.contains('systemConfig')  &amp;&amp; 
                       ! tiddler.tags.contains('systemTiddler') &amp;&amp; 
                       ! tiddler.tags.contains('styleTiddler')  &amp;&amp; 
                       ! tiddler.tags.contains('templateTiddler') )&quot;&gt;
   &lt;span macro=&quot;toggleTag #starred . 'Starred'&quot;&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/div&gt;

&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='view category'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;
&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="PageTemplate" modifier="escdie" created="201009180828" modified="201011071649" tags="%tw-elnb templateTiddler">
<pre>&lt;!--{{{--&gt;
&lt;!-- Header --&gt;
&lt;div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'&gt;
   &lt;div class='headerShadow'&gt;
      &lt;span class='siteTitle' refresh='content' tiddler='SiteTitle'&gt;&lt;/span&gt;&amp;nbsp;
      &lt;span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'&gt;&lt;/span&gt;
   &lt;/div&gt;
   &lt;div class='headerForeground'&gt;
      &lt;span class='siteTitle' refresh='content' tiddler='SiteTitle'&gt;&lt;/span&gt;&amp;nbsp;
      &lt;span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'&gt;&lt;/span&gt;
   &lt;/div&gt;
&lt;/div&gt;

&lt;!-- Top Menu --&gt;
&lt;div id='topMenu'&gt;
   &lt;table width=&quot;100%&quot;&gt;&lt;tr&gt;
   &lt;td align=&quot;left&quot;&gt;&lt;span refresh='content' tiddler='TopMenu'&gt;&lt;/span&gt;&lt;/td&gt;
   &lt;td align=&quot;right&quot;&gt;&lt;span macro='fontSize &quot;font-size:&quot;'&gt;&lt;/span&gt;&lt;span macro='search &quot;&quot; buttonAtRight:1'&gt;&lt;/span&gt;&lt;/td&gt;
   &lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;!--- Old top menu NOT USED
&lt;div id='topMenu' refresh='content' tiddler='TopMenu'&gt;&lt;/div&gt; 
---&gt;

&lt;!-- Main Menu --&gt;
&lt;div id='mainMenu' refresh='content' tiddler='MainMenu'&gt;&lt;/div&gt;

&lt;div id='sidebar'&gt;
   &lt;div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'&gt;&lt;/div&gt;
   &lt;div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;!-- Display --&gt;
&lt;div id='displayArea'&gt;
   &lt;div id='messageArea'&gt;&lt;/div&gt;
   &lt;div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'&gt;&lt;/div&gt;
   &lt;div id='tiddlerDisplay'&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;!--}}}--&gt;</pre>
</div>
<div title="Procedures" modifier="dger" created="201211280900" creator="dger">
<pre>&lt;&lt;forEachTiddler
      where 'tiddler.tags.contains(&quot;@procedure&quot;)'  
      sortBy 'tiddler.title'
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;</pre>
</div>
<div title="QuestionEditTemplate" modifier="escdie" created="201010251913" modified="201103221301" tags="%tw-elnb templateTiddler">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'&gt;&lt;span style=&quot;padding-right:0.15em;&quot; macro='monkeyTagger label:&quot;Status&quot; source:%QuestionStatusDB'&gt;&lt;/div&gt;
&lt;div class='title' macro='view subject'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit subject'&gt;&lt;/div&gt;
&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            TID: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit title&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;div macro='annotations'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;
&lt;span macro='tagChooser excludeLists'&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            Category: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit category&quot;&gt;&lt;/span&gt;
            Template: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit template&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="QuestionViewTemplate" modifier="escdie" created="201010142020" modified="201010251907" tags="%tw-elnb templateTiddler" template="" header="" category="">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view subject'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;) - TID: &lt;span class=&quot;view&quot; macro=&quot;view title&quot;&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='view category'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;

&lt;span macro='toggleTag #open'&gt;&lt;/span&gt;
&lt;span macro='toggleTag #closed'&gt;&lt;/span&gt;

&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="Questions" modifier="escdie" created="201008251616" modified="201101241820" tags="systemTiddler %tw-elnb">
<pre>!!!All questions
&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;question&quot;'
      sortBy 'tiddler.created' descending
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
!!!Open
&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;question&quot; &amp;&amp; tiddler.tags.contains(&quot;#open&quot;) ' 
      sortBy 'tiddler.created' descending
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="RecycleBin" modifier="dger" created="201008141706" modified="201009240921" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;list filter [tag[Trash]]&gt;&gt;
&lt;&lt;emptyTrash&gt;&gt;

&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="Resources" modifier="escdie" created="201008251619" modified="201107050905" tags="systemTiddler %tw-elnb">
<pre>*[[Attachements]]
*[[Documents]]
*[[Links]]
*[[File Drawer]]
</pre>
</div>
<div title="ScratchPad" modifier="escdie" created="201007171443" modified="201106151215" tags="systemTiddler %tw-elnb" template="ScratchPad" category="">
<pre></pre>
</div>
<div title="ScratchPadEditTemplate" modifier="escdie" created="201009240901" modified="201010260730" tags="templateTiddler %tw-elnb">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::NoDeleteEditToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div macro='annotations'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;
&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            Category: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit category&quot;&gt;&lt;/span&gt;
            Template: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit template&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="ScratchPadViewTemplate" modifier="escdie" created="201009271805" modified="201011031610" tags="templateTiddler %tw-elnb">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;)&lt;/div&gt;
&lt;div class='toolbar'&gt;&lt;/div&gt;

&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='view category'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;
&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="SettingsPanel" modifier="escdie" created="201011051729" modified="201011170849" tags="%tw-elnb systemTiddler">
<pre>[[Configuration]]
[[Plugins|PluginManager]]
[[elnbConfig|zz_elnbPackageConfig]]
[[UserConfig|zzz_UserConfig]]
[[TiddlerTextStyles|StyleSheetTiddlerText]]
</pre>
</div>
<div title="ShowPopup" modifier="escdie" created="201009181207" modified="201010261020" tags="%tw-elnb %extension transclusion macro plugin %elnb-hack">
<pre>/%
!info
|Name|ShowPopup|
|Source|http://www.TiddlyTools.com/#ShowPopup|
|Version|1.2.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transclusion|
|Description|display tiddler content in a TiddlyWiki popup panel|
Usage:
&lt;&lt;&lt;
{{{
&lt;&lt;tiddler ShowPopup with: TiddlerName label tooltip buttonClass width popupClass&gt;&gt;
}}}
where:
*''~TiddlerName''&lt;br&gt;title of the tiddler to be displayed
*''label''&lt;br&gt;text for the command link
*''tooltip''&lt;br&gt;mouseover help text for the link
*''buttonClass''&lt;br&gt;CSS classname applied to the command text (default=button)
*''width''&lt;br&gt;width of the popup (using CSS measurements, default=auto)
*''popupClass''&lt;br&gt;CSS classname applied to the popup panel (default=none).&lt;br&gt;Use 'sticky' for persistent popups (see StickyPopupPlugin)
&lt;&lt;&lt;
Example:
&lt;&lt;&lt;
{{{
&lt;&lt;tiddler ShowPopup with: ShowPopup [[Try this]] [[show this tiddler in a popup]]&gt;&gt;
}}}
&lt;&lt;tiddler ShowPopup with: ShowPopup [[Try this]] [[show this tiddler in a popup]]&gt;&gt;
&lt;&lt;&lt;
!end

!show
&lt;html&gt;&lt;hide linebreaks&gt;
&lt;a href=&quot;javascript:;&quot; class=&quot;$4&quot; title=&quot;$3&quot; onclick=&quot;
	var p=Popup.create(this); if(!p)return;
	p.className+='$6'!='$'+'6'?' $6':'';
	var d=createTiddlyElement(p,'div');
	var s=d.style;
	s.whiteSpace='normal';
	s.width='$5'!='$'+'5'?'$5':'auto';
	s.padding='2px';
	wikify(store.getTiddlerText('$1',''),d);
	Popup.show();
	event.cancelBubble=true;
	if(event.stopPropagation)event.stopPropagation();
	return(false);
&quot;&gt;$2&lt;/a&gt;&lt;/html&gt;
!end

%/&lt;&lt;tiddler {{'ShowPopup##'+('$1'=='$'+'1'?'info':'show')}} with: [[$1]] [[$2]] [[$3]] [[$4]] [[$5]] [[$6]]&gt;&gt;</pre>
</div>
<div title="SideBarOptions" modifier="escdie" created="201008280725" modified="201101301800" tags="systemTiddler %tw-elnb excludeLists">
<pre>--
&lt;&lt;newTiddler label:&quot;new tiddler&quot;&gt;&gt;&lt;&lt;permaview&gt;&gt;
&lt;&lt;elnbNewNote&gt;&gt;&lt;&lt;elnbNewJournal&gt;&gt;&lt;&lt;elnbNewTodo&gt;&gt;&lt;&lt;elnbNewQuestion&gt;&gt;&lt;&lt;elnbNewMeeting&gt;&gt;&lt;&lt;elnbNewReference&gt;&gt;&lt;&lt;elnbNewActivity&gt;&gt;&lt;&lt;attach&gt;&gt;
&lt;&lt;saveChanges &quot;save changes&quot;&gt;&gt;&lt;&lt;saveAndReload &quot;save &amp; reload&quot;&gt;&gt;&lt;&lt;closeAll&gt;&gt;
[[recycle bin|RecycleBin]][[unsaved tiddlers|UnsavedTiddlers]]
&lt;&lt;slider chkSliderOptionsPanel OptionsPanel &quot;options »&quot; &quot;Change TiddlyWiki advanced options&quot;&gt;&gt;&lt;&lt;slider chkSliderSettingsPanel SettingsPanel &quot;settings »&quot; &quot;Modify settings of the wiki&quot;&gt;&gt;&lt;&lt;slider chkSliderTiddlerPanel TiddlerPanel &quot;all tiddlers »&quot; &quot;List all tiddlers&quot;&gt;&gt;

</pre>
</div>
<div title="SideBarTabs" modifier="escdie" created="201010140652" modified="201011110941" tags="%tw-elnb">
<pre></pre>
</div>
<div title="SiteSubtitle" modifier="dger" created="201007221858" modified="201010201100" tags="systemTiddler">
<pre>Your work notes using TiddlyWiki</pre>
</div>
<div title="SiteTitle" modifier="escdie" created="201008150813" modified="201107090915" tags="systemTiddler">
<pre>tw-wnb</pre>
</div>
<div title="Starred" modifier="escdie" created="201009181619" modified="201011080758" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;list filter [tag[#starred]]&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="StyleSheet" modifier="escdie" created="201008301643" modified="201011170855" tags="%tw-elnb styleTiddler">
<pre>/* Style of wiki header */
[[StyleSheetHeader]] 

/* Style of the top menu */
[[StyleSheetTopMenu]] 

/* Style of the tiddlers */
[[StyleSheetTiddler]] 

/* Style of the syntax highlighter */
[[StyleSheetSyntaxHighlighter]]

/* Text */
[[StyleSheetTiddlerText]]</pre>
</div>
<div title="StyleSheetHeader" modifier="escdie" created="201011170853" tags="styleTiddler %tw-elnb">
<pre>/***
!StyleSheet for wiki header
***/

/*{{{*/
.headerShadow {
    padding: 1.5em;
}
.headerForeground {
    padding: 1.5em;
}
/*}}}*/</pre>
</div>
<div title="StyleSheetSyntaxHighlighter" modifier="dger" created="201007170950" modified="201009190905" tags="%tw-elnb styleTiddler">
<pre>/***
StyleSheet for ~SyntaxHighlighter
***/

/*{{{*/
.dp-highlighter
{
	font-family: &quot;Consolas&quot;, &quot;Courier New&quot;, Courier, mono, serif;
	font-size: 12px;
	background-color: #E7E5DC;
	width: 99%;
	overflow: auto;
	margin: 18px 0 18px 0 !important;
	padding-top: 1px; /* adds a little border on top when controls are hidden */
}

/* clear styles */
.dp-highlighter ol,
.dp-highlighter ol li,
.dp-highlighter ol li span 
{
	margin: 0;
	padding: 0;
	border: none;
}

.dp-highlighter a,
.dp-highlighter a:hover
{
	background: none;
	border: none;
	padding: 0;
	margin: 0;
}

.dp-highlighter .bar
{
	padding-left: 45px;
}

.dp-highlighter.collapsed .bar,
.dp-highlighter.nogutter .bar
{
	padding-left: 0px;
}

.dp-highlighter ol
{
	list-style: decimal; /* for ie */
	background-color: #fff;
	margin: 0px 0px 1px 45px !important; /* 1px bottom margin seems to fix occasional Firefox scrolling */
	padding: 0px;
	color: #5C5C5C;
}

.dp-highlighter.nogutter ol,
.dp-highlighter.nogutter ol li
{
	list-style: none !important;
	margin-left: 0px !important;
}

.dp-highlighter ol li,
.dp-highlighter .columns div
{
	list-style: decimal-leading-zero; /* better look for others, override cascade from OL */
	list-style-position: outside !important;
	border-left: 3px solid #6CE26C;
	background-color: #F8F8F8;
	color: #5C5C5C;
	padding: 0 3px 0 10px !important;
	margin: 0 !important;
	line-height: 14px;
}

.dp-highlighter.nogutter ol li,
.dp-highlighter.nogutter .columns div
{
	border: 0;
}

.dp-highlighter .columns
{
	background-color: #F8F8F8;
	color: gray;
	overflow: hidden;
	width: 100%;
}

.dp-highlighter .columns div
{
	padding-bottom: 5px;
}

.dp-highlighter ol li.alt
{
	background-color: #FFF;
	color: inherit;
}

.dp-highlighter ol li span
{
	color: black;
	background-color: inherit;
}

/* Adjust some properties when collapsed */

.dp-highlighter.collapsed ol
{
	margin: 0px;
}

.dp-highlighter.collapsed ol li
{
	display: none;
}

/* Additional modifications when in print-view */

.dp-highlighter.printing
{
	border: none;
}

.dp-highlighter.printing .tools
{
	display: none !important;
}

.dp-highlighter.printing li
{
	display: list-item !important;
}

/* Styles for the tools */

.dp-highlighter .tools
{
	padding: 3px 8px 3px 10px;
	font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif;
	color: silver;
	background-color: #f8f8f8;
	padding-bottom: 10px;
	border-left: 3px solid #6CE26C;
}

.dp-highlighter.nogutter .tools
{
	border-left: 0;
}

.dp-highlighter.collapsed .tools
{
	border-bottom: 0;
}

.dp-highlighter .tools a
{
	font-size: 9px;
	color: #a0a0a0;
	background-color: inherit;
	text-decoration: none;
	margin-right: 10px;
}

.dp-highlighter .tools a:hover
{
	color: red;
	background-color: inherit;
	text-decoration: underline;
}

/* About dialog styles */

.dp-about { background-color: #fff; color: #333; margin: 0px; padding: 0px; }
.dp-about table { width: 100%; height: 100%; font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; }
.dp-about td { padding: 10px; vertical-align: top; }
.dp-about .copy { border-bottom: 1px solid #ACA899; height: 95%; }
.dp-about .title { color: red; background-color: inherit; font-weight: bold; }
.dp-about .para { margin: 0 0 4px 0; }
.dp-about .footer { background-color: #ECEADB; color: #333; border-top: 1px solid #fff; text-align: right; }
.dp-about .close { font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; background-color: #ECEADB; color: #333; width: 60px; height: 22px; }

/* Language specific styles */

.dp-highlighter .comment, .dp-highlighter .comments { color: #008200; background-color: inherit; }
.dp-highlighter .string { color: blue; background-color: inherit; }
.dp-highlighter .keyword { color: #069; font-weight: bold; background-color: inherit; }
.dp-highlighter .preprocessor { color: gray; background-color: inherit; }

/*}}}*/</pre>
</div>
<div title="StyleSheetTagCloud" modifier="dger" created="201008280726" modified="201009190905" tags="%tw-elnb styleTiddler">
<pre>/*{{{*/
.tagCloud span {line-height: 3.5em; margin:3px;}
.tagCloud1{font-size: 80%;}
.tagCloud2{font-size: 100%;}
.tagCloud3{font-size: 120%;}
.tagCloud4{font-size: 140%;}
.tagCloud5{font-size: 160%;}
.tagCloud6{font-size: 180%;}
.tagCloud7{font-size: 200%;}
.tagCloud8{font-size: 220%;}
.tagCloud9{font-size: 240%;}
/*}}}*/</pre>
</div>
<div title="StyleSheetTiddler" modifier="escdie" created="201009180851" modified="201104080907" tags="%tw-elnb styleTiddler">
<pre>/***
!StyleSheet for tiddlers
***/
/*{{{*/

/* Basic tiddler */
/* -------------------------------------------------------------------------- */

/* Tiddler titles */
.title {
      font-size: 300%;
}

/* Give tiddlers style border and explicit */
.tiddler {
      border-top: 1px [[ColorPalette::PrimaryDark]] solid;
      border-right: 1px [[ColorPalette::PrimaryDark]] solid;
      border-left: 1px [[ColorPalette::PrimaryDark]] solid;
      border-bottom: 1px [[ColorPalette::PrimaryDark]] solid;
      margin-bottom: 1em;
      padding-bottom: 2em;
}

/*
div.tiddler .viewer {
     color: #FF0000;
} 
*/

/*}}}*/

/***
!StyleSheet for MeetingMinutes tiddlers
***/
/*{{{*/

/* MeetingMinutes tiddler */
/* -------------------------------------------------------------------------- */

/* View Template */

.mmViewFieldName {
      font-size: 100%;
      color: [[ColorPalette::SecondaryDark]];
      border-top: 1px;
      border-right: 1px;
      border-left: 1px;
      border-bottom: 1px;
      margin-top: 0.5em;
      margin-bottom: 0.5em;
}

.mmViewFieldValue {
      border-top: 1px;
      border-right: 1px;
      border-left: 1px;
      border-bottom: 1px;
      margin-top: 1em;
      margin-bottom: 1em;
}

.mmTitle {
      font-size: 150%;
      color: [[ColorPalette::SecondaryDark]];
      font-weight:bold;
      margin-top: 0.5em;
      margin-bottom: 0.5em;
}

/* Edit Template */

.mmEditFieldName {
      color:black;
}
.mmEditFieldValue input {
      border-top: 1px [[ColorPalette::SecondaryDark]] solid;
      border-right: 1px [[ColorPalette::SecondaryDark]] solid;
      border-left: 1px [[ColorPalette::SecondaryDark]] solid;
      border-bottom: 1px [[ColorPalette::SecondaryDark]] solid;
      margin-top: 0.5em;
      margin-bottom: 0.5em;
}

/* Category fields of a tiddler*/
.categoryFieldName {
      color:red;
}

.categoryFieldEdit input {
      border-top: 1px [[ColorPalette::SecondaryDark]] solid;
      border-right: 1px [[ColorPalette::SecondaryDark]] solid;
      border-left: 1px [[ColorPalette::SecondaryDark]] solid;
      border-bottom: 1px [[ColorPalette::SecondaryDark]] solid;
}

.templateFieldName .categoryFieldName
.templateFieldEdit .categoryFieldEdit

/*}}}*/
</pre>
</div>
<div title="StyleSheetTiddlerText" modifier="escdie" created="201011091731" modified="201105110924" tags="styleTiddler %tw-elnb">
<pre>/*{{{*/
/* font sizes */
.big
	{ font-size:14pt;line-height:120% }
.medium
	{ font-size:12pt;line-height:120% }
.normal
	{ font-size:9pt;line-height:120% }
.small
	{ font-size:8pt;line-height:120% }
.fine
	{ font-size:7pt;line-height:120% }
.tiny
	{ font-size:6pt;line-height:120% }
.larger
	{ font-size:120%; }
.smaller
	{ font-size:80%; }

/* font styles */
.bold
	{ font-weight:bold; }
.italic
	{ font-style:italic; }
.underline
	{ text-decoration:underline; }
/*}}}*/

/*{{{*/
.textHighlight {
   font-size:1.35em;
   font-family:arial,helvetica;
   font-style:bold; 
   color:red; }

.textImportant {
   font-size:100%;
   font-family:arial,helvetica;
   font-weight:bold;
   color:red; }

.moveover {
   margin-left:120px;
}

.textFunction {
   font-size:100%;
   font-family:arial,helvetica;
   font-weight:bold;
   color:green; }

.textPeople {
   font-size:125%;
   font-family:arial,helvetica;
   text-decoration: underline; }

.textTeam {
   font-size:125%;
   font-family:arial,helvetica;
   text-decoration: underline; }

.textCompany {
   font-size:125%;
   font-family:arial,helvetica;
   font-weight:bold;
   color:blue; }
/*}}}*/

/*{{{*/
/* text alignments */
.left
	{ display:block;text-align:left; }
.center
	{ display:block;text-align:center; }
.center table
	{ margin:auto !important; }
.right	
	{ display:block;text-align:right; }
.justify
	{ display:block;text-align:justify; }
.indent
	{ display:block;margin:0;padding:0;border:0;margin-left:2em; }
.floatleft
	{ float:left; }
.floatright
	{ float:right; }
.valignTop, .valignTop table, .valignTop tbody, .valignTop th, .valignTop tr, .valignTop td
	{ vertical-align:top; }
.valignBottom, .valignBottom table, .valignBottom tbody, .valignBottom th, .valignBottom tr, .valignBottom td
	{ vertical-align:bottom; }
.clear
	{ clear:both; }
.wrap
	{ white-space:normal; }
.nowrap
	{ white-space:nowrap; }
.hidden
	{ display:none; }
.show
	{ display:inline !important; }
.span
	{ display:span; }
.block
	{ display:block; }
.relative
	{ position:relative; }
.absolute
	{ position:absolute; }

/* font sizes */
.big
	{ font-size:14pt;line-height:120% }
.medium
	{ font-size:12pt;line-height:120% }
.normal
	{ font-size:9pt;line-height:120% }
.small
	{ font-size:8pt;line-height:120% }
.fine
	{ font-size:7pt;line-height:120% }
.tiny
	{ font-size:6pt;line-height:120% }
.larger
	{ font-size:120%; }
.smaller
	{ font-size:80%; }

/* font styles */
.bold
	{ font-weight:bold; }
.italic
	{ font-style:italic; }
.underline
	{ text-decoration:underline; }
/*}}}*/

/*{{{*/
/* */
.important {
   font-size:100%;
   font-family:arial,helvetica;
   font-weight:bold;
   color:red; }

.people {
   font-size:125%;
   font-family:arial,helvetica;
   text-decoration: underline; }

.team {
   font-size:125%;
   font-family:arial,helvetica;
   text-decoration: underline; }

.company {
   font-size:125%;
   font-family:arial,helvetica;
   font-weight:bold;
   color:blue; }

.activity {
   font-size:125%;
   font-family:arial,helvetica;
   font-weight:bold; }

.project {
   font-size:125%;
   font-family:arial,helvetica;
   font-weight:bold; }
/*}}}*/</pre>
</div>
<div title="StyleSheetTopMenu" modifier="dger" created="201009180850" modified="201009190904" tags="%tw-elnb styleTiddler">
<pre>/***
!StyleSheet for the TopMenu
***/

/*{{{*/

#topMenu br {
	display: none;
}

#topMenu {
	background: [[ColorPalette::PrimaryMid]];
	color:[[ColorPalette::PrimaryPale]];
}

#topMenu {
	padding:2px;
}

#topMenu .button, #topMenu .tiddlyLink, #topMenu a {
	margin-left: 0.5em;
	margin-right: 0.5em;
	padding-left: 3px;
	padding-right: 3px;
	color: [[ColorPalette::PrimaryPale]];
	font-size: 115%;
}
#topMenu .button:hover, #topMenu .tiddlyLink:hover {
	background: [[ColorPalette::PrimaryDark]];
}

/*}}}*/</pre>
</div>
<div title="TID" modifier="escdie" created="201010251833" modified="201010260913" tags="%tw-elnb systemTiddler">
<pre>20121221-1</pre>
</div>
<div title="TagCloud" modifier="escdie" created="201206210802" tags="%tw-elnb systemTiddler" creator="escdie">
<pre>!Tag Cloud
&lt;&lt;elnbTagCloud -HideCloudTags&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="TaskEditTemplate" modifier="escdie" created="201010251912" modified="201103221255" tags="%tw-elnb templateTiddler">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view subject'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit subject'&gt;&lt;/div&gt;
&lt;div class='toolbar'&gt;
&lt;span macro='monkeyTagger label:&quot;Action&quot; source:&quot;%ActionDB&quot;'&gt;
&lt;span macro='monkeyTagger label:&quot;Activity&quot; source:&quot;%ActivityDB&quot;'&gt;
&lt;span macro='monkeyTagger label:&quot;Status&quot; source:&quot;%TaskStatusDB&quot;'&gt;
&lt;/div&gt;
&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            TID: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit title&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;div macro='annotations'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;
&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;
&lt;span macro='tagChooser excludeLists'&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div macro=&quot;showWhen tiddler.tags.contains('%showCustomFields')&quot;&gt;
      &lt;div class=&quot;categoryFieldName&quot;&gt;
            Category: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit category&quot;&gt;&lt;/span&gt;
            Template: &lt;span class=&quot;categoryFieldEdit&quot; macro=&quot;edit template&quot;&gt;&lt;/span&gt;
      &lt;/div&gt;
&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="TaskViewTemplate" modifier="escdie" created="201102050932" modified="201103280755" tags="%tw-elnb templateTiddler">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view subject'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;) - TID: &lt;span class='view' macro='view title'&gt;&lt;/span&gt;&lt;/div&gt;

&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='view category'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;

&lt;span macro='toggleTag #ongoing'&gt;&lt;/span&gt;
&lt;span macro='toggleTag #now'&gt;&lt;/span&gt;
&lt;span macro='toggleTag #next'&gt;&lt;/span&gt;
&lt;span macro='toggleTag #waitingFor'&gt;&lt;/span&gt;
&lt;span macro='toggleTag #future'&gt;&lt;/span&gt;
&lt;span macro='toggleTag #done'&gt;&lt;/span&gt;
&lt;span macro='toggleTag #cancelled'&gt;&lt;/span&gt;

&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="Thoughts" modifier="escdie" created="201008251618" modified="201102211616" tags="systemTiddler %tw-elnb">
<pre>! TBD
&lt;&lt;forEachTiddler
      where 'tiddler.tags.contains(&quot;@thoughts&quot;) &amp; !tiddler.tags.contains(&quot;#done&quot;)  &amp; !tiddler.tags.contains(&quot;#cancelled&quot;)'  
      sortBy 'tiddler.title'
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
! Done/Cancelled
&lt;&lt;forEachTiddler
      where 'tiddler.tags.contains(&quot;@thoughts&quot;) &amp; ( tiddler.tags.contains(&quot;#done&quot;) | tiddler.tags.contains(&quot;#cancelled&quot;) )' 
      sortBy 'tiddler.title'
      write &quot; '* [[' + store.getTiddlerSubject(tiddler) + '|' + tiddler.title + ']]\n' &quot;&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="TiddlerPanel" modifier="dger" created="201010140653" tags="%tw-elnb">
<pre>&lt;&lt;tabs txtMainTab &quot;Timeline&quot; &quot;Timeline&quot; TabTimeline &quot;All&quot; &quot;All tiddlers&quot; TabAll &quot;Tags&quot; &quot;All tags&quot; TabTags &quot;More&quot; &quot;More lists&quot; TabMore&gt;&gt;</pre>
</div>
<div title="Timeline" modifier="escdie" created="201102071143" modified="201102081733" tags="%tw-elnb systemTiddler">
<pre>&lt;&lt;elnbLastUpdates &quot;modified&quot; &quot;30&quot;&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="ToDoFinished" modifier="escdie" created="201009020813" modified="201101170848" tags="systemTiddler %tw-elnb">
<pre>!Completed
&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot;  &amp;&amp; 
      tiddler.tags.contains(&quot;#done&quot;)'
      sortBy 'tiddler.created' descending
      write &quot;'* [[' +store.getTiddlerSubject(tiddler)+ '|'+tiddler.title+']]\n'&quot;&gt;&gt;
!Cancelled
&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot;  &amp;&amp; 
      tiddler.tags.contains(&quot;#cancelled&quot;)'
      sortBy 'tiddler.created' descending
      write &quot;'* [[' +store.getTiddlerSubject(tiddler)+ '|'+tiddler.title+']]\n'&quot;&gt;&gt;
&lt;&lt;autoRefresh&gt;&gt;</pre>
</div>
<div title="ToDoFuture" modifier="escdie" created="201009101335" modified="201011110943" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot;  &amp;&amp; 
      tiddler.tags.contains(&quot;#future&quot;)' 
      sortBy 'tiddler.title'
      write &quot;'* [[' +store.getTiddlerSubject(tiddler)+ '|'+tiddler.title+']]\n'&quot;&gt;&gt;</pre>
</div>
<div title="ToDoNext" modifier="escdie" created="201009101337" modified="201011110943" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot;  &amp;&amp; 
      tiddler.tags.contains(&quot;#next&quot;)' 
      sortBy 'tiddler.title'
      write &quot;'* [[' +store.getTiddlerSubject(tiddler)+ '|'+tiddler.title+']]\n'&quot;&gt;&gt;</pre>
</div>
<div title="ToDoNow" modifier="escdie" created="201009101334" modified="201012170931" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot;  &amp;&amp; 
      tiddler.tags.contains(&quot;#now&quot;)' 
      sortBy 'tiddler.title'
      write &quot;'* [[' +store.getTiddlerSubject(tiddler)+ '|'+tiddler.title + ']]\n' &quot;&gt;&gt;</pre>
</div>
<div title="ToDoOngoing" modifier="dger" created="201009101334" modified="201009240904" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot;  &amp;&amp; 
      tiddler.tags.contains(&quot;#ongoing&quot;)' 
      sortBy 'tiddler.title'
      write &quot;'* [['+tiddler.title+'|'+tiddler.title+']]\n'&quot;&gt;&gt;</pre>
</div>
<div title="ToDoUnknown" modifier="dger" created="201009020754" modified="201009240904" tags="systemTiddler %tw-elnb">
<pre>&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot;  &amp;&amp; 
      ( ! tiddler.tags.contains(&quot;now&quot;) &amp;&amp;
        ! !tiddler.tags.contains(&quot;future&quot;) )'
      sortBy 'tiddler.title'
      write &quot;'* [['+tiddler.title+'|'+tiddler.title+']]\n'&quot;&gt;&gt;
</pre>
</div>
<div title="ToDoWaitingFor" modifier="escdie" created="201103201030" modified="201103280754" tags="systemTiddler %tw-elnb" creator="escdie">
<pre>&lt;&lt;forEachTiddler
      where 'store.getValue(tiddler,&quot;category&quot;) == &quot;task&quot;  &amp;&amp; 
      tiddler.tags.contains(&quot;#waitingFor&quot;)' 
      sortBy 'tiddler.created' descending
      write &quot;'* [[' +store.getTiddlerSubject(tiddler)+ '|'+tiddler.title+']]\n'&quot;&gt;&gt;</pre>
</div>
<div title="ToggleLeftSidebar" modifier="dger" created="201009180918" modified="201009240935" tags="transclusion bookmarklet %tw-elnb">
<pre>/%
!info
|Name|ToggleLeftSidebar|
|Source|http://www.TiddlyTools.com/#ToggleLeftSidebar|
|Version|2.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transclusion|
|Description|show/hide left sidebar (MainMenu)|
Usage
&lt;&lt;&lt;
{{{
&lt;&lt;tiddler ToggleLeftSidebar&gt;&gt;
&lt;&lt;tiddler ToggleLeftSidebar with: label tooltip&gt;&gt;
}}}
Try it: &lt;&lt;tiddler ToggleLeftSidebar##show
	with: {{config.options.chkShowLeftSidebar?'◄':'►'}}&gt;&gt;
&lt;&lt;&lt;
Configuration:
&lt;&lt;&lt;
{{{
config.options.chkShowLeftSidebar (true)
config.options.txtToggleLeftSideBarLabelShow (►)
config.options.txtToggleLeftSideBarLabelHide (◄)
}}}
&lt;&lt;&lt;
!end
!show
&lt;&lt;tiddler {{
	var co=config.options;
	if (co.chkShowLeftSidebar===undefined) co.chkShowLeftSidebar=true;
	var mm=document.getElementById('mainMenu');
	var da=document.getElementById('displayArea');
	if (mm) {
		mm.style.display=co.chkShowLeftSidebar?'block':'none';
		da.style.marginLeft=co.chkShowLeftSidebar?'':'1em';
	}
'';}}&gt;&gt;&lt;html&gt;&lt;nowiki&gt;&lt;a href='javascript:;' title=&quot;$2&quot;
onmouseover=&quot;
	this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
	+encodeURIComponent(encodeURIComponent(this.onclick))
	+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';&quot;
onclick=&quot;
	var co=config.options;
	var opt='chkShowLeftSidebar';
	var show=co[opt]=!co[opt];
	var mm=document.getElementById('mainMenu');
	var da=document.getElementById('displayArea');
	if (mm) {
		mm.style.display=show?'block':'none';
		da.style.marginLeft=show?'':'1em';
	}
	saveOptionCookie(opt);
	var labelShow=co.txtToggleLeftSideBarLabelShow||'&amp;#x25BA;';
	var labelHide=co.txtToggleLeftSideBarLabelHide||'&amp;#x25C4;';
	if (this.innerHTML==labelShow||this.innerHTML==labelHide) 
		this.innerHTML=show?labelHide:labelShow;
	this.title=(show?'hide':'show')+' left sidebar';
	var sm=document.getElementById('storyMenu');
	if (sm) config.refreshers.content(sm);
	return false;
&quot;&gt;$1&lt;/a&gt;&lt;/html&gt;
!end
%/&lt;&lt;tiddler {{
	var src='ToggleLeftSidebar';
	src+(tiddler&amp;&amp;tiddler.title==src?'##info':'##show');
}} with: {{
	var co=config.options;
	var labelShow=co.txtToggleLeftSideBarLabelShow||'&amp;#x25BA;';
	var labelHide=co.txtToggleLeftSideBarLabelHide||'&amp;#x25C4;';
	'$1'!='$'+'1'?'$1':(co.chkShowLeftSidebar?labelHide:labelShow);
}} {{
	var tip=(config.options.chkShowLeftSidebar?'hide':'show')+' left sidebar';
	'$2'!='$'+'2'?'$2':tip;
}}&gt;&gt;</pre>
</div>
<div title="ToggleRightSidebar" modifier="dger" created="201007211628" modified="201009240937" tags="transclusion bookmarklet %tw-elnb">
<pre>/%
!info
|Name|ToggleRightSidebar|
|Source|http://www.TiddlyTools.com/#ToggleRightSidebar|
|Version|2.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transclusion|
|Description|show/hide right sidebar (SideBarOptions)|
Usage
&lt;&lt;&lt;
{{{
&lt;&lt;tiddler ToggleRightSidebar&gt;&gt;
&lt;&lt;tiddler ToggleRightSidebar with: label tooltip&gt;&gt;
}}}
Try it: &lt;&lt;tiddler ToggleRightSidebar##show
	with: {{config.options.chkShowRightSidebar?'►':'◄'}}&gt;&gt;
&lt;&lt;&lt;
Configuration:
&lt;&lt;&lt;
{{{
config.options.chkShowRightSidebar (true)
config.options.txtToggleRightSideBarLabelShow (◄)
config.options.txtToggleRightSideBarLabelHide (►)
}}}
&lt;&lt;&lt;
!end
!show
&lt;&lt;tiddler {{
	var co=config.options;
	if (co.chkShowRightSidebar===undefined) co.chkShowRightSidebar=true;
	var sb=document.getElementById('sidebar');
	var da=document.getElementById('displayArea');
	if (sb) {
		sb.style.display=co.chkShowRightSidebar?'block':'none';
		da.style.marginRight=co.chkShowRightSidebar?'':'1em';
	}
'';}}&gt;&gt;&lt;html&gt;&lt;nowiki&gt;&lt;a href='javascript:;' title=&quot;$2&quot;
onmouseover=&quot;
	this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
	+encodeURIComponent(encodeURIComponent(this.onclick))
	+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';&quot;
onclick=&quot;
	var co=config.options;
	var opt='chkShowRightSidebar';
	var show=co[opt]=!co[opt];
	var sb=document.getElementById('sidebar');
	var da=document.getElementById('displayArea');
	if (sb) {
		sb.style.display=show?'block':'none';
		da.style.marginRight=show?'':'1em';
	}
	saveOptionCookie(opt);
	var labelShow=co.txtToggleRightSideBarLabelShow||'&amp;#x25C4;';
	var labelHide=co.txtToggleRightSideBarLabelHide||'&amp;#x25BA;';
	if (this.innerHTML==labelShow||this.innerHTML==labelHide) 
		this.innerHTML=show?labelHide:labelShow;
	this.title=(show?'hide':'show')+' right sidebar';
	var sm=document.getElementById('storyMenu');
	if (sm) config.refreshers.content(sm);
	return false;
&quot;&gt;$1&lt;/a&gt;&lt;/html&gt;
!end
%/&lt;&lt;tiddler {{
	var src='ToggleRightSidebar';
	src+(tiddler&amp;&amp;tiddler.title==src?'##info':'##show');
}} with: {{
	var co=config.options;
	var labelShow=co.txtToggleRightSideBarLabelShow||'&amp;#x25C4;';
	var labelHide=co.txtToggleRightSideBarLabelHide||'&amp;#x25BA;';
	'$1'!='$'+'1'?'$1':(co.chkShowRightSidebar?labelHide:labelShow);
}} {{
	var tip=(config.options.chkShowRightSidebar?'hide':'show')+' right sidebar';
	'$2'!='$'+'2'?'$2':tip;
}}&gt;&gt;</pre>
</div>
<div title="ToolbarCommands" modifier="escdie" created="201007081008" modified="201101301807" tags="%tw-elnb">
<pre>|~ViewToolbar|closeTiddler closeOthers fullscreen editTiddler elnbCopyLink references &gt; fields syncing permalink snapshotSaveHere jump|
|~WysiwygViewToolbar|closeTiddler closeOthers fullscreen editTiddler editHtml elnbCopyLink references &gt; fields syncing permalink snapshotSaveHere jump|
|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|
|~NoDeleteEditToolbar|+saveTiddler -cancelTiddler|</pre>
</div>
<div title="TopMenu" modifier="escdie" created="201009180842" modified="201112200850" tags="systemTiddler %tw-elnb excludeLists">
<pre>[[Dashboard]]&lt;&lt;tiddler ShowPopup with: Starred [[Starred]] &quot;Show starred elements&quot;&gt;&gt;[[Timeline]][[ScratchPad]][[Calendar]]|[[Help]][[About]]|&lt;&lt;tiddler ToggleLeftSidebar&gt;&gt;&lt;&lt;tiddler ToggleRightSidebar&gt;&gt;
</pre>
</div>
<div title="Trash" modifier="TrashPlugin" created="201210160623">
<pre>&lt;&lt;emptyTrash&gt;&gt;</pre>
</div>
<div title="UnsavedTiddlers" modifier="dger" created="201010030952" modified="201010031044" tags="%tw-elnb systemTiddler" category="text">
<pre>&lt;&lt;unsavedChanges list &quot;&lt;br&gt;&quot;&gt;&gt;</pre>
</div>
<div title="ViewTemplate" modifier="dger" created="201008301645" modified="201010020936" tags="templateTiddler %tw-elnb">
<pre>&lt;!--{{{--&gt;
&lt;div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'&gt;&lt;/div&gt;
&lt;div class='title' macro='view title'&gt;&lt;/div&gt;
&lt;div class='subtitle'&gt;&lt;span macro='view modifier link'&gt;&lt;/span&gt;, &lt;span macro='view modified date'&gt;&lt;/span&gt; (&lt;span macro='message views.wikified.createdPrompt'&gt;&lt;/span&gt; &lt;span macro='view created date'&gt;&lt;/span&gt;)&lt;/div&gt;

&lt;div class='toolbar'&gt;
&lt;span macro=&quot;showWhen tiddler.tags.contains('systemConfig')&quot;&gt;
   &lt;span macro=&quot;toggleTag systemConfigDisable . 'Disable'&quot;&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;span macro=&quot;showWhen (! tiddler.tags.contains('systemConfig')  &amp;&amp; 
                       ! tiddler.tags.contains('systemTiddler') &amp;&amp; 
                       ! tiddler.tags.contains('styleTiddler')  &amp;&amp; 
                       ! tiddler.tags.contains('templateTiddler') )&quot;&gt;
   &lt;span macro=&quot;toggleTag #starred . 'Starred'&quot;&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/div&gt;

&lt;div class='tagging' macro='tagging'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='view category'&gt;&lt;/div&gt;
&lt;div class='tagged' macro='tags'&gt;&lt;/div&gt;
&lt;div class='viewer' macro='view text wikified'&gt;&lt;/div&gt;
&lt;div class='tagClear'&gt;&lt;/div&gt;
&lt;!--}}}--&gt;</pre>
</div>
<div title="YourSearch Help" modifier="dger" created="201007170953" modified="201010030932" tags="pluginInfo YourSearchExtension %tw-elnb">
<pre>!Field Search
With the Field Search you can restrict your search to certain fields of a tiddler, e.g only search the tags or only the titles. The general form is //fieldname//'':''//textToSearch// (e.g. {{{title:intro}}}). In addition one-character shortcuts are also supported for the standard fields {{{title}}}, {{{text}}} and {{{tags}}}:
|!What you want|!What you type|!Example|
|Search ''titles only''|start word with ''!''|{{{!jonny}}} (shortcut for {{{title:jonny}}})|
|Search ''contents/text only''|start word with ''%''|{{{%football}}} (shortcut for {{{text:football}}})|
|Search ''tags only''|start word with ''#''|{{{#Plugin}}} (shortcut for {{{tags:Plugin}}})|

Using this feature you may also search the extended fields (&quot;Metadata&quot;) introduced with TiddlyWiki 2.1, e.g. use {{{priority:1}}} to find all tiddlers with the priority field set to &quot;1&quot;.

You may search a word in more than one field. E.g. {{{!#Plugin}}} (or {{{title:tags:Plugin}}} in the &quot;long form&quot;) finds tiddlers containing &quot;Plugin&quot; either in the title or in the tags (but does not look for &quot;Plugin&quot; in the text). 

!Boolean Search
The Boolean Search is useful when searching for multiple words.
|!What you want|!What you type|!Example|
|''All words'' must exist|List of words|{{{jonny jeremy}}} (or {{{jonny and jeremy}}})|
|''At least one word'' must exist|Separate words by ''or''|{{{jonny or jeremy}}}|
|A word ''must not exist''|Start word with ''-''|{{{-jonny}}} (or {{{not jonny}}})|

''Note:'' When you specify two words, separated with a space, YourSearch finds all tiddlers that contain both words, but not necessarily next to each other. If you want to find a sequence of word, e.g. '{{{John Brown}}}', you need to put the words into quotes. I.e. you type: {{{&quot;john brown&quot;}}}.

Using parenthesis you may change the default &quot;left to right&quot; evaluation of the boolean search. E.g. {{{not (jonny or jeremy)}}} finds all tiddlers that contain neither &quot;jonny&quot; nor &quot;jeremy. In contrast to this {{{not jonny or jeremy}}} (i.e. without parenthesis) finds all tiddlers that either don't contain &quot;jonny&quot; or that contain &quot;jeremy&quot;.

!'Exact Word' Search
By default a search result all matches that 'contain' the searched text. E.g. if you search for {{{Task}}} you will get all tiddlers containing 'Task', but also '~CompletedTask', '~TaskForce' etc.

If you only want to get the tiddlers that contain 'exactly the word' you need to prefix it with a '='. E.g. typing '=Task' will find the tiddlers that contain the word 'Task', ignoring words that just contain 'Task' as a substring.

!~CaseSensitiveSearch and ~RegExpSearch
The standard search options ~CaseSensitiveSearch and ~RegExpSearch are fully supported by YourSearch. However when ''~RegExpSearch'' is on Filtered and Boolean Search are disabled.

In addition you may do a &quot;regular expression&quot; search even with the ''~RegExpSearch'' set to false by directly entering the regular expression into the search field, framed with {{{/.../}}}. 

Example: {{{/m[ae][iy]er/}}} will find all tiddlers that contain either &quot;maier&quot;, &quot;mayer&quot;, &quot;meier&quot; or &quot;meyer&quot;.

!~JavaScript Expression Filtering
If you are familiar with JavaScript programming and know some TiddlyWiki internals you may also use JavaScript expression for the search. Just enter a JavaScript boolean expression into the search field, framed with {{{ { ... } }}}. In the code refer to the variable tiddler and evaluate to {{{true}}} when the given tiddler should be included in the result. 

Example: {{{ { tiddler.modified &gt; new Date(&quot;Jul 4, 2005&quot;)} }}} returns all tiddler modified after July 4th, 2005.

!Combined Search
You are free to combine the various search options. 

''Examples''
|!What you type|!Result|
|{{{!jonny !jeremy -%football}}}|all tiddlers with both {{{jonny}}} and {{{jeremy}}} in its titles, but no {{{football}}} in content.|
|{{{#=Task}}}|All tiddlers tagged with 'Task' (the exact word). Tags named '~CompletedTask', '~TaskForce' etc. are not considered.|

!Access Keys
You are encouraged to use the access keys (also called &quot;shortcut&quot; keys) for the most frequently used operations. For quick reference these shortcuts are also mentioned in the tooltip for the various buttons etc.

|!Key|!Operation|
|{{{Alt-F}}}|''The most important keystroke'': It moves the cursor to the search input field so you can directly start typing your query. Pressing {{{Alt-F}}} will also display the previous search result. This way you can quickly display multiple tiddlers using &quot;Press {{{Alt-F}}}. Select tiddler.&quot; sequences.|
|{{{ESC}}}|Closes the [[YourSearch Result]]. When the [[YourSearch Result]] is already closed and the cursor is in the search input field the field's content is cleared so you start a new query.|
|{{{Alt-1}}}, {{{Alt-2}}},... |Pressing these keys opens the first, second etc. tiddler from the result list.|
|{{{Alt-O}}}|Opens all found tiddlers.|
|{{{Alt-P}}}|Toggles the 'Preview Text' mode.|
|{{{Alt-'&lt;'}}}, {{{Alt-'&gt;'}}}|Displays the previous or next page in the [[YourSearch Result]].|
|{{{Return}}}|When you have turned off the 'as you type' search mode pressing the {{{Return}}} key actually starts the search (as does pressing the 'search' button).|

//If some of these shortcuts don't work for you check your browser if you have other extensions installed that already &quot;use&quot; these shortcuts.//</pre>
</div>
<div title="YourSearchItemTemplate" modifier="escdie" created="201011071517" modified="201011082002" tags="templateTiddler %tw-elnb %elnb-hack elnbPackage">
<pre>&lt;!--{{{--&gt;
&lt;span class='yourSearchNumber' macro='foundTiddler number'&gt;&lt;/span&gt;
&lt;!--
&lt;div macro=&quot;showWhen store.existTiddlerSubject( &lt;&lt;foundTiddler title&gt;&gt; ) == true&quot;&gt;
KKKKKKKKKKKKKKKKKKKKKKKKK
&lt;/div&gt;
--&gt;
&lt;span class='yourSearchTitle' macro='foundTiddler title'&gt;&lt;/span&gt;&amp;nbsp;-&amp;nbsp;
&lt;span class='yourSearchTitle' macro='foundTiddler field &quot;subject&quot;'&gt;&lt;/span&gt;&amp;nbsp;-&amp;nbsp;
&lt;span class='yourSearchTags' macro='foundTiddler field tags 50'&gt;&lt;/span&gt;
&lt;span macro=&quot;yourSearch if previewText&quot;&gt;&lt;div class='yourSearchText' macro='foundTiddler field text 250'&gt;&lt;/div&gt;&lt;/span&gt;
&lt;!--}}}--&gt;</pre>
</div>
</div>
<!--POST-STOREAREA-->
<!--POST-BODY-START-->
<!--POST-BODY-END-->
<script id="jsArea" type="text/javascript">
//<![CDATA[
//
// Please note:
//
// * This code is designed to be readable but for compactness it only includes brief comments. You can see fuller comments
//   in the project Subversion repository at http://svn.tiddlywiki.org/Trunk/core/
//
// * You should never need to modify this source code directly. TiddlyWiki is carefully designed to allow deep customisation
//   without changing the core code. Please consult the development group at http://groups.google.com/group/TiddlyWikiDev
//

//--
//-- Configuration repository
//--

// Miscellaneous options
var config = {
	numRssItems: 20, // Number of items in the RSS feed
	animDuration: 400, // Duration of UI animations in milliseconds
	cascadeFast: 20, // Speed for cascade animations (higher == slower)
	cascadeSlow: 60, // Speed for EasterEgg cascade animations
	cascadeDepth: 5, // Depth of cascade animation
	locale: "en" // W3C language tag
};

// Hashmap of alternative parsers for the wikifier
config.parsers = {};

// Adaptors
config.adaptors = {};
config.defaultAdaptor = null;

// Backstage tasks
config.tasks = {};

// Annotations
config.annotations = {};

// Custom fields to be automatically added to new tiddlers
config.defaultCustomFields = {};

// Messages
config.messages = {
	messageClose: {},
	dates: {},
	tiddlerPopup: {}
};

// Options that can be set in the options panel and/or cookies
config.options = {
	chkRegExpSearch: false,
	chkCaseSensitiveSearch: false,
	chkIncrementalSearch: true,
	chkAnimate: true,
	chkSaveBackups: true,
	chkAutoSave: false,
	chkGenerateAnRssFeed: false,
	chkSaveEmptyTemplate: false,
	chkOpenInNewWindow: true,
	chkToggleLinks: false,
	chkHttpReadOnly: true,
	chkForceMinorUpdate: false,
	chkConfirmDelete: true,
	chkInsertTabs: false,
	chkUsePreForStorage: true, // Whether to use <pre> format for storage
	chkDisplayInstrumentation: false,
	txtBackupFolder: "",
	txtEditorFocus: "text",
	txtMainTab: "tabTimeline",
	txtMoreTab: "moreTabAll",
	txtMaxEditRows: "30",
	txtFileSystemCharSet: "UTF-8",
	txtTheme: ""
	};
config.optionsDesc = {};

config.optionsSource = {};

// Default tiddler templates
var DEFAULT_VIEW_TEMPLATE = 1;
var DEFAULT_EDIT_TEMPLATE = 2;
config.tiddlerTemplates = {
	1: "ViewTemplate",
	2: "EditTemplate"
};

// More messages (rather a legacy layout that should not really be like this)
config.views = {
	wikified: {
		tag: {}
	},
	editor: {
		tagChooser: {}
	}
};

// Backstage tasks
config.backstageTasks = ["save","sync","importTask","tweak","upgrade","plugins"];

// Extensions
config.extensions = {};

// Macros; each has a 'handler' member that is inserted later
config.macros = {
	today: {},
	version: {},
	search: {sizeTextbox: 15},
	tiddler: {},
	tag: {},
	tags: {},
	tagging: {},
	timeline: {},
	allTags: {},
	list: {
		all: {},
		missing: {},
		orphans: {},
		shadowed: {},
		touched: {},
		filter: {}
	},
	closeAll: {},
	permaview: {},
	saveChanges: {},
	slider: {},
	option: {},
	options: {},
	newTiddler: {},
	newJournal: {},
	tabs: {},
	gradient: {},
	message: {},
	view: {defaultView: "text"},
	edit: {},
	tagChooser: {},
	toolbar: {},
	plugins: {},
	refreshDisplay: {},
	importTiddlers: {},
	upgrade: {
		source: "http://www.tiddlywiki.com/upgrade/",
		backupExtension: "pre.core.upgrade"
	},
	sync: {},
	annotations: {}
};

// Commands supported by the toolbar macro
config.commands = {
	closeTiddler: {},
	closeOthers: {},
	editTiddler: {},
	saveTiddler: {hideReadOnly: true},
	cancelTiddler: {},
	deleteTiddler: {hideReadOnly: true},
	permalink: {},
	references: {type: "popup"},
	jump: {type: "popup"},
	syncing: {type: "popup"},
	fields: {type: "popup"}
};

// Browser detection... In a very few places, there's nothing else for it but to know what browser we're using.
config.userAgent = navigator.userAgent.toLowerCase();
config.browser = {
	isIE: config.userAgent.indexOf("msie") != -1 && config.userAgent.indexOf("opera") == -1,
	isGecko: navigator.product == "Gecko" && config.userAgent.indexOf("WebKit") == -1,
	ieVersion: /MSIE (\d.\d)/i.exec(config.userAgent), // config.browser.ieVersion[1], if it exists, will be the IE version string, eg "6.0"
	isSafari: config.userAgent.indexOf("applewebkit") != -1,
	isBadSafari: !((new RegExp("[\u0150\u0170]","g")).test("\u0150")),
	firefoxDate: /gecko\/(\d{8})/i.exec(config.userAgent), // config.browser.firefoxDate[1], if it exists, will be Firefox release date as "YYYYMMDD"
	isOpera: config.userAgent.indexOf("opera") != -1,
	isLinux: config.userAgent.indexOf("linux") != -1,
	isUnix: config.userAgent.indexOf("x11") != -1,
	isMac: config.userAgent.indexOf("mac") != -1,
	isWindows: config.userAgent.indexOf("win") != -1
};

// Control of macro parameter evaluation
config.evaluateMacroParameters = "all";

// Basic regular expressions
config.textPrimitives = {
	upperLetter: "[A-Z\u00c0-\u00de\u0150\u0170]",
	lowerLetter: "[a-z0-9_\\-\u00df-\u00ff\u0151\u0171]",
	anyLetter:   "[A-Za-z0-9_\\-\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]",
	anyLetterStrict: "[A-Za-z0-9\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]"
};
if(config.browser.isBadSafari) {
	config.textPrimitives = {
		upperLetter: "[A-Z\u00c0-\u00de]",
		lowerLetter: "[a-z0-9_\\-\u00df-\u00ff]",
		anyLetter:   "[A-Za-z0-9_\\-\u00c0-\u00de\u00df-\u00ff]",
		anyLetterStrict: "[A-Za-z0-9\u00c0-\u00de\u00df-\u00ff]"
	};
}
config.textPrimitives.sliceSeparator = "::";
config.textPrimitives.sectionSeparator = "##";
config.textPrimitives.urlPattern = "(?:file|http|https|mailto|ftp|irc|news|data):[^\\s'\"]+(?:/|\\b)";
config.textPrimitives.unWikiLink = "~";
config.textPrimitives.wikiLink = "(?:(?:" + config.textPrimitives.upperLetter + "+" +
	config.textPrimitives.lowerLetter + "+" +
	config.textPrimitives.upperLetter +
	config.textPrimitives.anyLetter + "*)|(?:" +
	config.textPrimitives.upperLetter + "{2,}" +
	config.textPrimitives.lowerLetter + "+))";

config.textPrimitives.cssLookahead = "(?:(" + config.textPrimitives.anyLetter + "+)\\(([^\\)\\|\\n]+)(?:\\):))|(?:(" + config.textPrimitives.anyLetter + "+):([^;\\|\\n]+);)";
config.textPrimitives.cssLookaheadRegExp = new RegExp(config.textPrimitives.cssLookahead,"mg");

config.textPrimitives.brackettedLink = "\\[\\[([^\\]]+)\\]\\]";
config.textPrimitives.titledBrackettedLink = "\\[\\[([^\\[\\]\\|]+)\\|([^\\[\\]\\|]+)\\]\\]";
config.textPrimitives.tiddlerForcedLinkRegExp = new RegExp("(?:" + config.textPrimitives.titledBrackettedLink + ")|(?:" +
	config.textPrimitives.brackettedLink + ")|(?:" +
	config.textPrimitives.urlPattern + ")","mg");
config.textPrimitives.tiddlerAnyLinkRegExp = new RegExp("("+ config.textPrimitives.wikiLink + ")|(?:" +
	config.textPrimitives.titledBrackettedLink + ")|(?:" +
	config.textPrimitives.brackettedLink + ")|(?:" +
	config.textPrimitives.urlPattern + ")","mg");

config.glyphs = {
	browsers: [
		function() {return config.browser.isIE;},
		function() {return true;}
	],
	currBrowser: null,
	codes: {
		downTriangle: ["\u25BC","\u25BE"],
		downArrow: ["\u2193","\u2193"],
		bentArrowLeft: ["\u2190","\u21A9"],
		bentArrowRight: ["\u2192","\u21AA"]
	}
};

//--
//-- Shadow tiddlers
//--

config.shadowTiddlers = {
	StyleSheet: "",
	MarkupPreHead: "",
	MarkupPostHead: "",
	MarkupPreBody: "",
	MarkupPostBody: "",
	TabTimeline: '<<timeline>>',
	TabAll: '<<list all>>',
	TabTags: '<<allTags excludeLists>>',
	TabMoreMissing: '<<list missing>>',
	TabMoreOrphans: '<<list orphans>>',
	TabMoreShadowed: '<<list shadowed>>',
	AdvancedOptions: '<<options>>',
	PluginManager: '<<plugins>>',
	ToolbarCommands: '|~ViewToolbar|closeTiddler closeOthers +editTiddler > fields syncing permalink references jump|\n|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|',
	WindowTitle: '<<tiddler SiteTitle>> - <<tiddler SiteSubtitle>>'
};

//--
//-- Translateable strings
//--

// Strings in "double quotes" should be translated; strings in 'single quotes' should be left alone

merge(config.options,{
	txtUserName: "YourName"});

merge(config.tasks,{
	save: {text: "save", tooltip: "Save your changes to this TiddlyWiki", action: saveChanges},
	sync: {text: "sync", tooltip: "Synchronise changes with other TiddlyWiki files and servers", content: '<<sync>>'},
	importTask: {text: "import", tooltip: "Import tiddlers and plugins from other TiddlyWiki files and servers", content: '<<importTiddlers>>'},
	tweak: {text: "tweak", tooltip: "Tweak the appearance and behaviour of TiddlyWiki", content: '<<options>>'},
	upgrade: {text: "upgrade", tooltip: "Upgrade TiddlyWiki core code", content: '<<upgrade>>'},
	plugins: {text: "plugins", tooltip: "Manage installed plugins", content: '<<plugins>>'}
});

// Options that can be set in the options panel and/or cookies
merge(config.optionsDesc,{
	txtUserName: "Username for signing your edits",
	chkRegExpSearch: "Enable regular expressions for searches",
	chkCaseSensitiveSearch: "Case-sensitive searching",
	chkIncrementalSearch: "Incremental key-by-key searching",
	chkAnimate: "Enable animations",
	chkSaveBackups: "Keep backup file when saving changes",
	chkAutoSave: "Automatically save changes",
	chkGenerateAnRssFeed: "Generate an RSS feed when saving changes",
	chkSaveEmptyTemplate: "Generate an empty template when saving changes",
	chkOpenInNewWindow: "Open external links in a new window",
	chkToggleLinks: "Clicking on links to open tiddlers causes them to close",
	chkHttpReadOnly: "Hide editing features when viewed over HTTP",
	chkForceMinorUpdate: "Don't update modifier username and date when editing tiddlers",
	chkConfirmDelete: "Require confirmation before deleting tiddlers",
	chkInsertTabs: "Use the tab key to insert tab characters instead of moving between fields",
	txtBackupFolder: "Name of folder to use for backups",
	txtMaxEditRows: "Maximum number of rows in edit boxes",
	txtTheme: "Name of the theme to use",
	txtFileSystemCharSet: "Default character set for saving changes (Firefox/Mozilla only)"});

merge(config.messages,{
	customConfigError: "Problems were encountered loading plugins. See PluginManager for details",
	pluginError: "Error: %0",
	pluginDisabled: "Not executed because disabled via 'systemConfigDisable' tag",
	pluginForced: "Executed because forced via 'systemConfigForce' tag",
	pluginVersionError: "Not executed because this plugin needs a newer version of TiddlyWiki",
	nothingSelected: "Nothing is selected. You must select one or more items first",
	savedSnapshotError: "It appears that this TiddlyWiki has been incorrectly saved. Please see http://www.tiddlywiki.com/#Download for details",
	subtitleUnknown: "(unknown)",
	undefinedTiddlerToolTip: "The tiddler '%0' doesn't yet exist",
	shadowedTiddlerToolTip: "The tiddler '%0' doesn't yet exist, but has a pre-defined shadow value",
	tiddlerLinkTooltip: "%0 - %1, %2",
	externalLinkTooltip: "External link to %0",
	noTags: "There are no tagged tiddlers",
	notFileUrlError: "You need to save this TiddlyWiki to a file before you can save changes",
	cantSaveError: "It's not possible to save changes. Possible reasons include:\n- your browser doesn't support saving (Firefox, Internet Explorer, Safari and Opera all work if properly configured)\n- the pathname to your TiddlyWiki file contains illegal characters\n- the TiddlyWiki HTML file has been moved or renamed",
	invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
	backupSaved: "Backup saved",
	backupFailed: "Failed to save backup file",
	rssSaved: "RSS feed saved",
	rssFailed: "Failed to save RSS feed file",
	emptySaved: "Empty template saved",
	emptyFailed: "Failed to save empty template file",
	mainSaved: "Main TiddlyWiki file saved",
	mainFailed: "Failed to save main TiddlyWiki file. Your changes have not been saved",
	macroError: "Error in macro <<\%0>>",
	macroErrorDetails: "Error while executing macro <<\%0>>:\n%1",
	missingMacro: "No such macro",
	overwriteWarning: "A tiddler named '%0' already exists. Choose OK to overwrite it",
	unsavedChangesWarning: "WARNING! There are unsaved changes in TiddlyWiki\n\nChoose OK to save\nChoose CANCEL to discard",
	confirmExit: "--------------------------------\n\nThere are unsaved changes in TiddlyWiki. If you continue you will lose those changes\n\n--------------------------------",
	saveInstructions: "SaveChanges",
	unsupportedTWFormat: "Unsupported TiddlyWiki format '%0'",
	tiddlerSaveError: "Error when saving tiddler '%0'",
	tiddlerLoadError: "Error when loading tiddler '%0'",
	wrongSaveFormat: "Cannot save with storage format '%0'. Using standard format for save.",
	invalidFieldName: "Invalid field name %0",
	fieldCannotBeChanged: "Field '%0' cannot be changed",
	loadingMissingTiddler: "Attempting to retrieve the tiddler '%0' from the '%1' server at:\n\n'%2' in the workspace '%3'",
	upgradeDone: "The upgrade to version %0 is now complete\n\nClick 'OK' to reload the newly upgraded TiddlyWiki",
	invalidCookie: "Invalid cookie '%0'"});

merge(config.messages.messageClose,{
	text: "close",
	tooltip: "close this message area"});

config.messages.backstage = {
	open: {text: "backstage", tooltip: "Open the backstage area to perform authoring and editing tasks"},
	close: {text: "close", tooltip: "Close the backstage area"},
	prompt: "backstage: ",
	decal: {
		edit: {text: "edit", tooltip: "Edit the tiddler '%0'"}
	}
};

config.messages.listView = {
	tiddlerTooltip: "Click for the full text of this tiddler",
	previewUnavailable: "(preview not available)"
};

config.messages.dates.months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November","December"];
config.messages.dates.days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
config.messages.dates.shortMonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
config.messages.dates.shortDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
// suffixes for dates, eg "1st","2nd","3rd"..."30th","31st"
config.messages.dates.daySuffixes = ["st","nd","rd","th","th","th","th","th","th","th",
		"th","th","th","th","th","th","th","th","th","th",
		"st","nd","rd","th","th","th","th","th","th","th",
		"st"];
config.messages.dates.am = "am";
config.messages.dates.pm = "pm";

merge(config.messages.tiddlerPopup,{
	});

merge(config.views.wikified.tag,{
	labelNoTags: "no tags",
	labelTags: "tags: ",
	openTag: "Open tag '%0'",
	tooltip: "Show tiddlers tagged with '%0'",
	openAllText: "Open all",
	openAllTooltip: "Open all of these tiddlers",
	popupNone: "No other tiddlers tagged with '%0'"});

merge(config.views.wikified,{
	defaultText: "The tiddler '%0' doesn't yet exist. Double-click to create it",
	defaultModifier: "(missing)",
	shadowModifier: "(built-in shadow tiddler)",
	dateFormat: "DD MMM YYYY",
	createdPrompt: "created"});

merge(config.views.editor,{
	tagPrompt: "Type tags separated with spaces, [[use double square brackets]] if necessary, or add existing",
	defaultText: "Type the text for '%0'"});

merge(config.views.editor.tagChooser,{
	text: "tags",
	tooltip: "Choose existing tags to add to this tiddler",
	popupNone: "There are no tags defined",
	tagTooltip: "Add the tag '%0'"});

merge(config.messages,{
	sizeTemplates:
		[
		{unit: 1024*1024*1024, template: "%0\u00a0GB"},
		{unit: 1024*1024, template: "%0\u00a0MB"},
		{unit: 1024, template: "%0\u00a0KB"},
		{unit: 1, template: "%0\u00a0B"}
		]});

merge(config.macros.search,{
	label: "search",
	prompt: "Search this TiddlyWiki",
	accessKey: "F",
	successMsg: "%0 tiddlers found matching %1",
	failureMsg: "No tiddlers found matching %0"});

merge(config.macros.tagging,{
	label: "tagging: ",
	labelNotTag: "not tagging",
	tooltip: "List of tiddlers tagged with '%0'"});

merge(config.macros.timeline,{
	dateFormat: "DD MMM YYYY"});

merge(config.macros.allTags,{
	tooltip: "Show tiddlers tagged with '%0'",
	noTags: "There are no tagged tiddlers"});

config.macros.list.all.prompt = "All tiddlers in alphabetical order";
config.macros.list.missing.prompt = "Tiddlers that have links to them but are not defined";
config.macros.list.orphans.prompt = "Tiddlers that are not linked to from any other tiddlers";
config.macros.list.shadowed.prompt = "Tiddlers shadowed with default contents";
config.macros.list.touched.prompt = "Tiddlers that have been modified locally";

merge(config.macros.closeAll,{
	label: "close all",
	prompt: "Close all displayed tiddlers (except any that are being edited)"});

merge(config.macros.permaview,{
	label: "permaview",
	prompt: "Link to an URL that retrieves all the currently displayed tiddlers"});

merge(config.macros.saveChanges,{
	label: "save changes",
	prompt: "Save all tiddlers to create a new TiddlyWiki",
	accessKey: "S"});

merge(config.macros.newTiddler,{
	label: "new tiddler",
	prompt: "Create a new tiddler",
	title: "New Tiddler",
	accessKey: "N"});

merge(config.macros.newJournal,{
	label: "new journal",
	prompt: "Create a new tiddler from the current date and time",
	accessKey: "J"});

merge(config.macros.options,{
	wizardTitle: "Tweak advanced options",
	step1Title: "These options are saved in cookies in your browser",
	step1Html: "<input type='hidden' name='markList'></input><br><input type='checkbox' checked='false' name='chkUnknown'>Show unknown options</input>",
	unknownDescription: "//(unknown)//",
	listViewTemplate: {
		columns: [
			{name: 'Option', field: 'option', title: "Option", type: 'String'},
			{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
			{name: 'Name', field: 'name', title: "Name", type: 'String'}
			],
		rowClasses: [
			{className: 'lowlight', field: 'lowlight'}
			]}
	});

merge(config.macros.plugins,{
	wizardTitle: "Manage plugins",
	step1Title: "Currently loaded plugins",
	step1Html: "<input type='hidden' name='markList'></input>", // DO NOT TRANSLATE
	skippedText: "(This plugin has not been executed because it was added since startup)",
	noPluginText: "There are no plugins installed",
	confirmDeleteText: "Are you sure you want to delete these plugins:\n\n%0",
	removeLabel: "remove systemConfig tag",
	removePrompt: "Remove systemConfig tag",
	deleteLabel: "delete",
	deletePrompt: "Delete these tiddlers forever",
	listViewTemplate: {
		columns: [
			{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'},
			{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
			{name: 'Description', field: 'Description', title: "Description", type: 'String'},
			{name: 'Version', field: 'Version', title: "Version", type: 'String'},
			{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'},
			{name: 'Forced', field: 'forced', title: "Forced", tag: 'systemConfigForce', type: 'TagCheckbox'},
			{name: 'Disabled', field: 'disabled', title: "Disabled", tag: 'systemConfigDisable', type: 'TagCheckbox'},
			{name: 'Executed', field: 'executed', title: "Loaded", type: 'Boolean', trueText: "Yes", falseText: "No"},
			{name: 'Startup Time', field: 'startupTime', title: "Startup Time", type: 'String'},
			{name: 'Error', field: 'error', title: "Status", type: 'Boolean', trueText: "Error", falseText: "OK"},
			{name: 'Log', field: 'log', title: "Log", type: 'StringList'}
			],
		rowClasses: [
			{className: 'error', field: 'error'},
			{className: 'warning', field: 'warning'}
			]},
	listViewTemplateReadOnly: {
		columns: [
			{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
			{name: 'Description', field: 'Description', title: "Description", type: 'String'},
			{name: 'Version', field: 'Version', title: "Version", type: 'String'},
			{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'},
			{name: 'Executed', field: 'executed', title: "Loaded", type: 'Boolean', trueText: "Yes", falseText: "No"},
			{name: 'Startup Time', field: 'startupTime', title: "Startup Time", type: 'String'},
			{name: 'Error', field: 'error', title: "Status", type: 'Boolean', trueText: "Error", falseText: "OK"},
			{name: 'Log', field: 'log', title: "Log", type: 'StringList'}
			],
		rowClasses: [
			{className: 'error', field: 'error'},
			{className: 'warning', field: 'warning'}
			]}
	});

merge(config.macros.toolbar,{
	moreLabel: "more",
	morePrompt: "Show additional commands",
	lessLabel: "less",
	lessPrompt: "Hide additional commands",
	separator: "|"
	});

merge(config.macros.refreshDisplay,{
	label: "refresh",
	prompt: "Redraw the entire TiddlyWiki display"
	});

merge(config.macros.importTiddlers,{
	readOnlyWarning: "You cannot import into a read-only TiddlyWiki file. Try opening it from a file:// URL",
	wizardTitle: "Import tiddlers from another file or server",
	step1Title: "Step 1: Locate the server or TiddlyWiki file",
	step1Html: "Specify the type of the server: <select name='selTypes'><option value=''>Choose...</option></select><br>Enter the URL or pathname here: <input type='text' size=50 name='txtPath'><br>...or browse for a file: <input type='file' size=50 name='txtBrowse'><br><hr>...or select a pre-defined feed: <select name='selFeeds'><option value=''>Choose...</option></select>",
	openLabel: "open",
	openPrompt: "Open the connection to this file or server",
	statusOpenHost: "Opening the host",
	statusGetWorkspaceList: "Getting the list of available workspaces",
	step2Title: "Step 2: Choose the workspace",
	step2Html: "Enter a workspace name: <input type='text' size=50 name='txtWorkspace'><br>...or select a workspace: <select name='selWorkspace'><option value=''>Choose...</option></select>",
	cancelLabel: "cancel",
	cancelPrompt: "Cancel this import",
	statusOpenWorkspace: "Opening the workspace",
	statusGetTiddlerList: "Getting the list of available tiddlers",
	errorGettingTiddlerList: "Error getting list of tiddlers, click Cancel to try again",
	step3Title: "Step 3: Choose the tiddlers to import",
	step3Html: "<input type='hidden' name='markList'></input><br><input type='checkbox' checked='true' name='chkSync'>Keep these tiddlers linked to this server so that you can synchronise subsequent changes</input><br><input type='checkbox' name='chkSave'>Save the details of this server in a 'systemServer' tiddler called:</input> <input type='text' size=25 name='txtSaveTiddler'>",
	importLabel: "import",
	importPrompt: "Import these tiddlers",
	confirmOverwriteText: "Are you sure you want to overwrite these tiddlers:\n\n%0",
	step4Title: "Step 4: Importing %0 tiddler(s)",
	step4Html: "<input type='hidden' name='markReport'></input>", // DO NOT TRANSLATE
	doneLabel: "done",
	donePrompt: "Close this wizard",
	statusDoingImport: "Importing tiddlers",
	statusDoneImport: "All tiddlers imported",
	systemServerNamePattern: "%2 on %1",
	systemServerNamePatternNoWorkspace: "%1",
	confirmOverwriteSaveTiddler: "The tiddler '%0' already exists. Click 'OK' to overwrite it with the details of this server, or 'Cancel' to leave it unchanged",
	serverSaveTemplate: "|''Type:''|%0|\n|''URL:''|%1|\n|''Workspace:''|%2|\n\nThis tiddler was automatically created to record the details of this server",
	serverSaveModifier: "(System)",
	listViewTemplate: {
		columns: [
			{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'},
			{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
			{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'},
			{name: 'Tags', field: 'tags', title: "Tags", type: 'Tags'}
			],
		rowClasses: [
			]}
	});

merge(config.macros.upgrade,{
	wizardTitle: "Upgrade TiddlyWiki core code",
	step1Title: "Update or repair this TiddlyWiki to the latest release",
	step1Html: "You are about to upgrade to the latest release of the TiddlyWiki core code (from <a href='%0' class='externalLink' target='_blank'>%1</a>). Your content will be preserved across the upgrade.<br><br>Note that core upgrades have been known to interfere with older plugins. If you run into problems with the upgraded file, see <a href='http://www.tiddlywiki.org/wiki/CoreUpgrades' class='externalLink' target='_blank'>http://www.tiddlywiki.org/wiki/CoreUpgrades</a>",
	errorCantUpgrade: "Unable to upgrade this TiddlyWiki. You can only perform upgrades on TiddlyWiki files stored locally",
	errorNotSaved: "You must save changes before you can perform an upgrade",
	step2Title: "Confirm the upgrade details",
	step2Html_downgrade: "You are about to downgrade to TiddlyWiki version %0 from %1.<br><br>Downgrading to an earlier version of the core code is not recommended",
	step2Html_restore: "This TiddlyWiki appears to be already using the latest version of the core code (%0).<br><br>You can continue to upgrade anyway to ensure that the core code hasn't been corrupted or damaged",
	step2Html_upgrade: "You are about to upgrade to TiddlyWiki version %0 from %1",
	upgradeLabel: "upgrade",
	upgradePrompt: "Prepare for the upgrade process",
	statusPreparingBackup: "Preparing backup",
	statusSavingBackup: "Saving backup file",
	errorSavingBackup: "There was a problem saving the backup file",
	statusLoadingCore: "Loading core code",
	errorLoadingCore: "Error loading the core code",
	errorCoreFormat: "Error with the new core code",
	statusSavingCore: "Saving the new core code",
	statusReloadingCore: "Reloading the new core code",
	startLabel: "start",
	startPrompt: "Start the upgrade process",
	cancelLabel: "cancel",
	cancelPrompt: "Cancel the upgrade process",
	step3Title: "Upgrade cancelled",
	step3Html: "You have cancelled the upgrade process"
	});

merge(config.macros.sync,{
	listViewTemplate: {
		columns: [
			{name: 'Selected', field: 'selected', rowName: 'title', type: 'Selector'},
			{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
			{name: 'Server Type', field: 'serverType', title: "Server type", type: 'String'},
			{name: 'Server Host', field: 'serverHost', title: "Server host", type: 'String'},
			{name: 'Server Workspace', field: 'serverWorkspace', title: "Server workspace", type: 'String'},
			{name: 'Status', field: 'status', title: "Synchronisation status", type: 'String'},
			{name: 'Server URL', field: 'serverUrl', title: "Server URL", text: "View", type: 'Link'}
			],
		rowClasses: [
			],
		buttons: [
			{caption: "Sync these tiddlers", name: 'sync'}
			]},
	wizardTitle: "Synchronize with external servers and files",
	step1Title: "Choose the tiddlers you want to synchronize",
	step1Html: "<input type='hidden' name='markList'></input>", // DO NOT TRANSLATE
	syncLabel: "sync",
	syncPrompt: "Sync these tiddlers",
	hasChanged: "Changed while unplugged",
	hasNotChanged: "Unchanged while unplugged",
	syncStatusList: {
		none: {text: "...", display:'none', className:'notChanged'},
		changedServer: {text: "Changed on server", display:null, className:'changedServer'},
		changedLocally: {text: "Changed while unplugged", display:null, className:'changedLocally'},
		changedBoth: {text: "Changed while unplugged and on server", display:null, className:'changedBoth'},
		notFound: {text: "Not found on server", display:null, className:'notFound'},
		putToServer: {text: "Saved update on server", display:null, className:'putToServer'},
		gotFromServer: {text: "Retrieved update from server", display:null, className:'gotFromServer'}
		}
	});

merge(config.macros.annotations,{
	});

merge(config.commands.closeTiddler,{
	text: "close",
	tooltip: "Close this tiddler"});

merge(config.commands.closeOthers,{
	text: "close others",
	tooltip: "Close all other tiddlers"});

merge(config.commands.editTiddler,{
	text: "edit",
	tooltip: "Edit this tiddler",
	readOnlyText: "view",
	readOnlyTooltip: "View the source of this tiddler"});

merge(config.commands.saveTiddler,{
	text: "done",
	tooltip: "Save changes to this tiddler"});

merge(config.commands.cancelTiddler,{
	text: "cancel",
	tooltip: "Undo changes to this tiddler",
	warning: "Are you sure you want to abandon your changes to '%0'?",
	readOnlyText: "done",
	readOnlyTooltip: "View this tiddler normally"});

merge(config.commands.deleteTiddler,{
	text: "delete",
	tooltip: "Delete this tiddler",
	warning: "Are you sure you want to delete '%0'?"});

merge(config.commands.permalink,{
	text: "permalink",
	tooltip: "Permalink for this tiddler"});

merge(config.commands.references,{
	text: "references",
	tooltip: "Show tiddlers that link to this one",
	popupNone: "No references"});

merge(config.commands.jump,{
	text: "jump",
	tooltip: "Jump to another open tiddler"});

merge(config.commands.syncing,{
	text: "syncing",
	tooltip: "Control synchronisation of this tiddler with a server or external file",
	currentlySyncing: "<div>Currently syncing via <span class='popupHighlight'>'%0'</span> to:</"+"div><div>host: <span class='popupHighlight'>%1</span></"+"div><div>workspace: <span class='popupHighlight'>%2</span></"+"div>", // Note escaping of closing <div> tag
	notCurrentlySyncing: "Not currently syncing",
	captionUnSync: "Stop synchronising this tiddler",
	chooseServer: "Synchronise this tiddler with another server:",
	currServerMarker: "\u25cf ",
	notCurrServerMarker: "  "});

merge(config.commands.fields,{
	text: "fields",
	tooltip: "Show the extended fields of this tiddler",
	emptyText: "There are no extended fields for this tiddler",
	listViewTemplate: {
		columns: [
			{name: 'Field', field: 'field', title: "Field", type: 'String'},
			{name: 'Value', field: 'value', title: "Value", type: 'String'}
			],
		rowClasses: [
			],
		buttons: [
			]}});

merge(config.shadowTiddlers,{
	DefaultTiddlers: "[[GettingStarted]]",
	MainMenu: "[[GettingStarted]]",
	SiteTitle: "My TiddlyWiki",
	SiteSubtitle: "a reusable non-linear personal web notebook",
	SiteUrl: "",
	SideBarOptions: '<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "options \u00bb" "Change TiddlyWiki advanced options">>',
	SideBarTabs: '<<tabs txtMainTab "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>',
	TabMore: '<<tabs txtMoreTab "Missing" "Missing tiddlers" TabMoreMissing "Orphans" "Orphaned tiddlers" TabMoreOrphans "Shadowed" "Shadowed tiddlers" TabMoreShadowed>>'
	});

merge(config.annotations,{
	AdvancedOptions: "This shadow tiddler provides access to several advanced options",
	ColorPalette: "These values in this shadow tiddler determine the colour scheme of the ~TiddlyWiki user interface",
	DefaultTiddlers: "The tiddlers listed in this shadow tiddler will be automatically displayed when ~TiddlyWiki starts up",
	EditTemplate: "The HTML template in this shadow tiddler determines how tiddlers look while they are being edited",
	GettingStarted: "This shadow tiddler provides basic usage instructions",
	ImportTiddlers: "This shadow tiddler provides access to importing tiddlers",
	MainMenu: "This shadow tiddler is used as the contents of the main menu in the left-hand column of the screen",
	MarkupPreHead: "This tiddler is inserted at the top of the <head> section of the TiddlyWiki HTML file",
	MarkupPostHead: "This tiddler is inserted at the bottom of the <head> section of the TiddlyWiki HTML file",
	MarkupPreBody: "This tiddler is inserted at the top of the <body> section of the TiddlyWiki HTML file",
	MarkupPostBody: "This tiddler is inserted at the end of the <body> section of the TiddlyWiki HTML file immediately after the script block",
	OptionsPanel: "This shadow tiddler is used as the contents of the options panel slider in the right-hand sidebar",
	PageTemplate: "The HTML template in this shadow tiddler determines the overall ~TiddlyWiki layout",
	PluginManager: "This shadow tiddler provides access to the plugin manager",
	SideBarOptions: "This shadow tiddler is used as the contents of the option panel in the right-hand sidebar",
	SideBarTabs: "This shadow tiddler is used as the contents of the tabs panel in the right-hand sidebar",
	SiteSubtitle: "This shadow tiddler is used as the second part of the page title",
	SiteTitle: "This shadow tiddler is used as the first part of the page title",
	SiteUrl: "This shadow tiddler should be set to the full target URL for publication",
	StyleSheetColors: "This shadow tiddler contains CSS definitions related to the color of page elements. ''DO NOT EDIT THIS TIDDLER'', instead make your changes in the StyleSheet shadow tiddler",
	StyleSheet: "This tiddler can contain custom CSS definitions",
	StyleSheetLayout: "This shadow tiddler contains CSS definitions related to the layout of page elements. ''DO NOT EDIT THIS TIDDLER'', instead make your changes in the StyleSheet shadow tiddler",
	StyleSheetLocale: "This shadow tiddler contains CSS definitions related to the translation locale",
	StyleSheetPrint: "This shadow tiddler contains CSS definitions for printing",
	SystemSettings: "This tiddler is used to store configuration options for this TiddlyWiki document",
	TabAll: "This shadow tiddler contains the contents of the 'All' tab in the right-hand sidebar",
	TabMore: "This shadow tiddler contains the contents of the 'More' tab in the right-hand sidebar",
	TabMoreMissing: "This shadow tiddler contains the contents of the 'Missing' tab in the right-hand sidebar",
	TabMoreOrphans: "This shadow tiddler contains the contents of the 'Orphans' tab in the right-hand sidebar",
	TabMoreShadowed: "This shadow tiddler contains the contents of the 'Shadowed' tab in the right-hand sidebar",
	TabTags: "This shadow tiddler contains the contents of the 'Tags' tab in the right-hand sidebar",
	TabTimeline: "This shadow tiddler contains the contents of the 'Timeline' tab in the right-hand sidebar",
	ToolbarCommands: "This shadow tiddler determines which commands are shown in tiddler toolbars",
	ViewTemplate: "The HTML template in this shadow tiddler determines how tiddlers look"
	});
//--
//-- Main
//--

var params = null; // Command line parameters
var store = null; // TiddlyWiki storage
var story = null; // Main story
var formatter = null; // Default formatters for the wikifier
var anim = typeof Animator == "function" ? new Animator() : null; // Animation engine
var readOnly = false; // Whether we're in readonly mode
var highlightHack = null; // Embarrassing hack department...
var hadConfirmExit = false; // Don't warn more than once
var safeMode = false; // Disable all plugins and cookies
var showBackstage; // Whether to include the backstage area
var installedPlugins = []; // Information filled in when plugins are executed
var startingUp = false; // Whether we're in the process of starting up
var pluginInfo,tiddler; // Used to pass information to plugins in loadPlugins()

// Whether to use the JavaSaver applet
var useJavaSaver = (config.browser.isSafari || config.browser.isOpera) && (document.location.toString().substr(0,4) != "http");

// Starting up
function main()
{
	var t10,t9,t8,t7,t6,t5,t4,t3,t2,t1,t0 = new Date();
	startingUp = true;
	var doc = jQuery(document);
	jQuery.noConflict();
	window.onbeforeunload = function(e) {if(window.confirmExit) return confirmExit();};
	params = getParameters();
	if(params)
		params = params.parseParams("open",null,false);
	store = new TiddlyWiki();
	invokeParamifier(params,"oninit");
	story = new Story("tiddlerDisplay","tiddler");
	addEvent(document,"click",Popup.onDocumentClick);
	saveTest();
	for(var s=0; s<config.notifyTiddlers.length; s++)
		store.addNotification(config.notifyTiddlers[s].name,config.notifyTiddlers[s].notify);
	t1 = new Date();
	loadShadowTiddlers();
	doc.trigger("loadShadows");
	t2 = new Date();
	store.loadFromDiv("storeArea","store",true);
	doc.trigger("loadTiddlers");
	loadOptions();
	t3 = new Date();
	invokeParamifier(params,"onload");
	t4 = new Date();
	readOnly = (window.location.protocol == "file:") ? false : config.options.chkHttpReadOnly;
	var pluginProblem = loadPlugins("systemConfig");
	doc.trigger("loadPlugins");
	t5 = new Date();
	formatter = new Formatter(config.formatters);
	invokeParamifier(params,"onconfig");
	story.switchTheme(config.options.txtTheme);
	showBackstage = showBackstage !== undefined ? showBackstage : !readOnly;
	t6 = new Date();
	for(var m in config.macros) {
		if(config.macros[m].init)
			config.macros[m].init();
	}
	t7 = new Date();
	store.notifyAll();
	t8 = new Date();
	restart();
	refreshDisplay();
	t9 = new Date();
	if(pluginProblem) {
		story.displayTiddler(null,"PluginManager");
		displayMessage(config.messages.customConfigError);
	}
	if(showBackstage)
		backstage.init();
	t10 = new Date();
	if(config.options.chkDisplayInstrumentation) {
		displayMessage("LoadShadows " + (t2-t1) + " ms");
		displayMessage("LoadFromDiv " + (t3-t2) + " ms");
		displayMessage("LoadPlugins " + (t5-t4) + " ms");
		displayMessage("Macro init " + (t7-t6) + " ms");
		displayMessage("Notify " + (t8-t7) + " ms");
		displayMessage("Restart " + (t9-t8) + " ms");
		displayMessage("Total: " + (t10-t0) + " ms");
	}
	startingUp = false;
	doc.trigger("startup");
}

// Called on unload. All functions called conditionally since they themselves may have been unloaded.
function unload()
{
	if(window.checkUnsavedChanges)
		checkUnsavedChanges();
	if(window.scrubNodes)
		scrubNodes(document.body);
}

// Restarting
function restart()
{
	invokeParamifier(params,"onstart");
	if(story.isEmpty()) {
		story.displayDefaultTiddlers();
	}
	window.scrollTo(0,0);
}

function saveTest()
{
	var s = document.getElementById("saveTest");
	if(s.hasChildNodes())
		alert(config.messages.savedSnapshotError);
	s.appendChild(document.createTextNode("savetest"));
}

function loadShadowTiddlers()
{
	var shadows = new TiddlyWiki();
	shadows.loadFromDiv("shadowArea","shadows",true);
	shadows.forEachTiddler(function(title,tiddler){config.shadowTiddlers[title] = tiddler.text;});
}

function loadPlugins(tag)
{
	if(safeMode)
		return false;
	var tiddlers = store.getTaggedTiddlers(tag);
	tiddlers.sort(function(a,b) {return a.title < b.title ? -1 : (a.title == b.title ? 0 : 1);});
	var toLoad = [];
	var nLoaded = 0;
	var map = {};
	var nPlugins = tiddlers.length;
	installedPlugins = [];
	for(var i=0; i<nPlugins; i++) {
		var p = getPluginInfo(tiddlers[i]);
		installedPlugins[i] = p;
		var n = p.Name || p.title;
		if(n)
			map[n] = p;
		n = p.Source;
		if(n)
			map[n] = p;
	}
	var visit = function(p) {
		if(!p || p.done)
			return;
		p.done = 1;
		var reqs = p.Requires;
		if(reqs) {
			reqs = reqs.readBracketedList();
			for(var i=0; i<reqs.length; i++)
				visit(map[reqs[i]]);
		}
		toLoad.push(p);
	};
	for(i=0; i<nPlugins; i++)
		visit(installedPlugins[i]);
	for(i=0; i<toLoad.length; i++) {
		p = toLoad[i];
		pluginInfo = p;
		tiddler = p.tiddler;
		if(isPluginExecutable(p)) {
			if(isPluginEnabled(p)) {
				p.executed = true;
				var startTime = new Date();
				try {
					if(tiddler.text)
						window.eval(tiddler.text);
					nLoaded++;
				} catch(ex) {
					p.log.push(config.messages.pluginError.format([exceptionText(ex)]));
					p.error = true;
					if(!console.tiddlywiki) {
						console.log("error evaluating " + tiddler.title, ex);
					}
				}
				pluginInfo.startupTime = String((new Date()) - startTime) + "ms";
			} else {
				nPlugins--;
			}
		} else {
			p.warning = true;
		}
	}
	return nLoaded != nPlugins;
}

function getPluginInfo(tiddler)
{
	var p = store.getTiddlerSlices(tiddler.title,["Name","Description","Version","Requires","CoreVersion","Date","Source","Author","License","Browsers"]);
	p.tiddler = tiddler;
	p.title = tiddler.title;
	p.log = [];
	return p;
}

// Check that a particular plugin is valid for execution
function isPluginExecutable(plugin)
{
	if(plugin.tiddler.isTagged("systemConfigForce")) {
		plugin.log.push(config.messages.pluginForced);
		return true;
	}
	if(plugin["CoreVersion"]) {
		var coreVersion = plugin["CoreVersion"].split(".");
		var w = parseInt(coreVersion[0],10) - version.major;
		if(w == 0 && coreVersion[1])
			w = parseInt(coreVersion[1],10) - version.minor;
		if(w == 0 && coreVersion[2])
			w = parseInt(coreVersion[2],10) - version.revision;
		if(w > 0) {
			plugin.log.push(config.messages.pluginVersionError);
			return false;
		}
	}
	return true;
}

function isPluginEnabled(plugin)
{
	if(plugin.tiddler.isTagged("systemConfigDisable")) {
		plugin.log.push(config.messages.pluginDisabled);
		return false;
	}
	return true;
}

function invokeMacro(place,macro,params,wikifier,tiddler)
{
	try {
		var m = config.macros[macro];
		if(m && m.handler) {
			var tiddlerElem = story.findContainingTiddler(place);
			window.tiddler = tiddlerElem ? store.getTiddler(tiddlerElem.getAttribute("tiddler")) : null;
			window.place = place;
			var allowEval = true;
			if(config.evaluateMacroParameters=="system") {
				if(!tiddler || tiddler.tags.indexOf("systemAllowEval") == -1) {
					allowEval = false;
				}
			}
			m.handler(place,macro,m.noPreParse?null:params.readMacroParams(!allowEval),wikifier,params,tiddler);
		} else {
			createTiddlyError(place,config.messages.macroError.format([macro]),config.messages.macroErrorDetails.format([macro,config.messages.missingMacro]));
		}
	} catch(ex) {
		createTiddlyError(place,config.messages.macroError.format([macro]),config.messages.macroErrorDetails.format([macro,ex.toString()]));
	}
}

//--
//-- Paramifiers
//--

function getParameters()
{
	var p = null;
	if(window.location.hash) {
		p = decodeURIComponent(window.location.hash.substr(1));
		if(config.browser.firefoxDate != null && config.browser.firefoxDate[1] < "20051111")
			p = convertUTF8ToUnicode(p);
	}
	return p;
}

function invokeParamifier(params,handler)
{
	if(!params || params.length == undefined || params.length <= 1)
		return;
	for(var i=1; i<params.length; i++) {
		var p = config.paramifiers[params[i].name];
		if(p && p[handler] instanceof Function)
			p[handler](params[i].value);
		else {
			var h = config.optionHandlers[params[i].name.substr(0,3)];
			if(h && h.set instanceof Function)
				h.set(params[i].name,params[i].value);
		}
	}
}

config.paramifiers = {};

config.paramifiers.start = {
	oninit: function(v) {
		safeMode = v.toLowerCase() == "safe";
	}
};

config.paramifiers.open = {
	onstart: function(v) {
		if(!readOnly || store.tiddlerExists(v) || store.isShadowTiddler(v))
			story.displayTiddler("bottom",v,null,false,null);
	}
};

config.paramifiers.story = {
	onstart: function(v) {
		var list = store.getTiddlerText(v,"").parseParams("open",null,false);
		invokeParamifier(list,"onstart");
	}
};

config.paramifiers.search = {
	onstart: function(v) {
		story.search(v,false,false);
	}
};

config.paramifiers.searchRegExp = {
	onstart: function(v) {
		story.prototype.search(v,false,true);
	}
};

config.paramifiers.tag = {
	onstart: function(v) {
		story.displayTiddlers(null,store.filterTiddlers("[tag["+v+"]]"),null,false,null);
	}
};

config.paramifiers.newTiddler = {
	onstart: function(v) {
		if(!readOnly) {
			story.displayTiddler(null,v,DEFAULT_EDIT_TEMPLATE);
			story.focusTiddler(v,"text");
		}
	}
};

config.paramifiers.newJournal = {
	onstart: function(v) {
		if(!readOnly) {
			var now = new Date();
			var title = now.formatString(v.trim());
			story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE);
			story.focusTiddler(title,"text");
		}
	}
};

config.paramifiers.readOnly = {
	onconfig: function(v) {
		var p = v.toLowerCase();
		readOnly = p == "yes" ? true : (p == "no" ? false : readOnly);
	}
};

config.paramifiers.theme = {
	onconfig: function(v) {
		story.switchTheme(v);
	}
};

config.paramifiers.upgrade = {
	onstart: function(v) {
		upgradeFrom(v);
	}
};

config.paramifiers.recent= {
	onstart: function(v) {
		var titles=[];
		var tiddlers=store.getTiddlers("modified","excludeLists").reverse();
		for(var i=0; i<v && i<tiddlers.length; i++)
			titles.push(tiddlers[i].title);
		story.displayTiddlers(null,titles);
	}
};

config.paramifiers.filter = {
	onstart: function(v) {
		story.displayTiddlers(null,store.filterTiddlers(v),null,false);
	}
};

//--
//-- Formatter helpers
//--

function Formatter(formatters)
{
	this.formatters = [];
	var pattern = [];
	for(var n=0; n<formatters.length; n++) {
		pattern.push("(" + formatters[n].match + ")");
		this.formatters.push(formatters[n]);
	}
	this.formatterRegExp = new RegExp(pattern.join("|"),"mg");
}

config.formatterHelpers = {

	createElementAndWikify: function(w)
	{
		w.subWikifyTerm(createTiddlyElement(w.output,this.element),this.termRegExp);
	},

	inlineCssHelper: function(w)
	{
		var styles = [];
		config.textPrimitives.cssLookaheadRegExp.lastIndex = w.nextMatch;
		var lookaheadMatch = config.textPrimitives.cssLookaheadRegExp.exec(w.source);
		while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
			var s,v;
			if(lookaheadMatch[1]) {
				s = lookaheadMatch[1].unDash();
				v = lookaheadMatch[2];
			} else {
				s = lookaheadMatch[3].unDash();
				v = lookaheadMatch[4];
			}
			if(s=="bgcolor")
				s = "backgroundColor";
			if(s=="float")
				s = "cssFloat";
			styles.push({style: s, value: v});
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
			config.textPrimitives.cssLookaheadRegExp.lastIndex = w.nextMatch;
			lookaheadMatch = config.textPrimitives.cssLookaheadRegExp.exec(w.source);
		}
		return styles;
	},

	applyCssHelper: function(e,styles)
	{
		for(var t=0; t< styles.length; t++) {
			try {
				e.style[styles[t].style] = styles[t].value;
			} catch (ex) {
			}
		}
	},

	enclosedTextHelper: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var text = lookaheadMatch[1];
			if(config.browser.isIE)
				text = text.replace(/\n/g,"\r");
			createTiddlyElement(w.output,this.element,null,null,text);
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
		}
	},

	isExternalLink: function(link)
	{
		if(store.tiddlerExists(link) || store.isShadowTiddler(link)) {
			return false;
		}
		var urlRegExp = new RegExp(config.textPrimitives.urlPattern,"mg");
		if(urlRegExp.exec(link)) {
			return true;
		}
		if(link.indexOf(".")!=-1 || link.indexOf("\\")!=-1 || link.indexOf("/")!=-1 || link.indexOf("#")!=-1) {
			return true;
		}
		return false;
	}

};

//--
//-- Standard formatters
//--

config.formatters = [
{
	name: "table",
	match: "^\\|(?:[^\\n]*)\\|(?:[fhck]?)$",
	lookaheadRegExp: /^\|([^\n]*)\|([fhck]?)$/mg,
	rowTermRegExp: /(\|(?:[fhck]?)$\n?)/mg,
	cellRegExp: /(?:\|([^\n\|]*)\|)|(\|[fhck]?$\n?)/mg,
	cellTermRegExp: /((?:\x20*)\|)/mg,
	rowTypes: {"c":"caption", "h":"thead", "":"tbody", "f":"tfoot"},
	handler: function(w)
	{
		var table = createTiddlyElement(w.output,"table",null,"twtable");
		var prevColumns = [];
		var currRowType = null;
		var rowContainer;
		var rowCount = 0;
		w.nextMatch = w.matchStart;
		this.lookaheadRegExp.lastIndex = w.nextMatch;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
			var nextRowType = lookaheadMatch[2];
			if(nextRowType == "k") {
				table.className = lookaheadMatch[1];
				w.nextMatch += lookaheadMatch[0].length+1;
			} else {
				if(nextRowType != currRowType) {
					rowContainer = createTiddlyElement(table,this.rowTypes[nextRowType]);
					currRowType = nextRowType;
				}
				if(currRowType == "c") {
					// Caption
					w.nextMatch++;
					if(rowContainer != table.firstChild)
						table.insertBefore(rowContainer,table.firstChild);
					rowContainer.setAttribute("align",rowCount == 0?"top":"bottom");
					w.subWikifyTerm(rowContainer,this.rowTermRegExp);
				} else {
					var theRow = createTiddlyElement(rowContainer,"tr",null,(rowCount&1)?"oddRow":"evenRow");
					theRow.onmouseover = function() {addClass(this,"hoverRow");};
					theRow.onmouseout = function() {removeClass(this,"hoverRow");};
					this.rowHandler(w,theRow,prevColumns);
					rowCount++;
				}
			}
			this.lookaheadRegExp.lastIndex = w.nextMatch;
			lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		}
	},
	rowHandler: function(w,e,prevColumns)
	{
		var col = 0;
		var colSpanCount = 1;
		var prevCell = null;
		this.cellRegExp.lastIndex = w.nextMatch;
		var cellMatch = this.cellRegExp.exec(w.source);
		while(cellMatch && cellMatch.index == w.nextMatch) {
			if(cellMatch[1] == "~") {
				// Rowspan
				var last = prevColumns[col];
				if(last) {
					last.rowSpanCount++;
					last.element.setAttribute("rowspan",last.rowSpanCount);
					last.element.setAttribute("rowSpan",last.rowSpanCount); // Needed for IE
					last.element.valign = "center";
					if(colSpanCount > 1) {
						last.element.setAttribute("colspan",colSpanCount);
						last.element.setAttribute("colSpan",colSpanCount); // Needed for IE
						colSpanCount = 1;
					}
				}
				w.nextMatch = this.cellRegExp.lastIndex-1;
			} else if(cellMatch[1] == ">") {
				// Colspan
				colSpanCount++;
				w.nextMatch = this.cellRegExp.lastIndex-1;
			} else if(cellMatch[2]) {
				// End of row
				if(prevCell && colSpanCount > 1) {
					prevCell.setAttribute("colspan",colSpanCount);
					prevCell.setAttribute("colSpan",colSpanCount); // Needed for IE
				}
				w.nextMatch = this.cellRegExp.lastIndex;
				break;
			} else {
				// Cell
				w.nextMatch++;
				var styles = config.formatterHelpers.inlineCssHelper(w);
				var spaceLeft = false;
				var chr = w.source.substr(w.nextMatch,1);
				while(chr == " ") {
					spaceLeft = true;
					w.nextMatch++;
					chr = w.source.substr(w.nextMatch,1);
				}
				var cell;
				if(chr == "!") {
					cell = createTiddlyElement(e,"th");
					w.nextMatch++;
				} else {
					cell = createTiddlyElement(e,"td");
				}
				prevCell = cell;
				prevColumns[col] = {rowSpanCount:1,element:cell};
				if(colSpanCount > 1) {
					cell.setAttribute("colspan",colSpanCount);
					cell.setAttribute("colSpan",colSpanCount); // Needed for IE
					colSpanCount = 1;
				}
				config.formatterHelpers.applyCssHelper(cell,styles);
				w.subWikifyTerm(cell,this.cellTermRegExp);
				if(w.matchText.substr(w.matchText.length-2,1) == " ") // spaceRight
					cell.align = spaceLeft ? "center" : "left";
				else if(spaceLeft)
					cell.align = "right";
				w.nextMatch--;
			}
			col++;
			this.cellRegExp.lastIndex = w.nextMatch;
			cellMatch = this.cellRegExp.exec(w.source);
		}
	}
},

{
	name: "heading",
	match: "^!{1,6}",
	termRegExp: /(\n)/mg,
	handler: function(w)
	{
		w.subWikifyTerm(createTiddlyElement(w.output,"h" + w.matchLength),this.termRegExp);
	}
},

{
	name: "list",
	match: "^(?:[\\*#;:]+)",
	lookaheadRegExp: /^(?:(?:(\*)|(#)|(;)|(:))+)/mg,
	termRegExp: /(\n)/mg,
	handler: function(w)
	{
		var stack = [w.output];
		var currLevel = 0, currType = null;
		var listLevel, listType, itemType, baseType;
		w.nextMatch = w.matchStart;
		this.lookaheadRegExp.lastIndex = w.nextMatch;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
			if(lookaheadMatch[1]) {
				listType = "ul";
				itemType = "li";
			} else if(lookaheadMatch[2]) {
				listType = "ol";
				itemType = "li";
			} else if(lookaheadMatch[3]) {
				listType = "dl";
				itemType = "dt";
			} else if(lookaheadMatch[4]) {
				listType = "dl";
				itemType = "dd";
			}
			if(!baseType)
				baseType = listType;
			listLevel = lookaheadMatch[0].length;
			w.nextMatch += lookaheadMatch[0].length;
			var t;
			if(listLevel > currLevel) {
				for(t=currLevel; t<listLevel; t++) {
					var target = (currLevel == 0) ? stack[stack.length-1] : stack[stack.length-1].lastChild;
					stack.push(createTiddlyElement(target,listType));
				}
			} else if(listType!=baseType && listLevel==1) {
				w.nextMatch -= lookaheadMatch[0].length;
				return;
			} else if(listLevel < currLevel) {
				for(t=currLevel; t>listLevel; t--)
					stack.pop();
			} else if(listLevel == currLevel && listType != currType) {
				stack.pop();
				stack.push(createTiddlyElement(stack[stack.length-1].lastChild,listType));
			}
			currLevel = listLevel;
			currType = listType;
			var e = createTiddlyElement(stack[stack.length-1],itemType);
			w.subWikifyTerm(e,this.termRegExp);
			this.lookaheadRegExp.lastIndex = w.nextMatch;
			lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		}
	}
},

{
	name: "quoteByBlock",
	match: "^<<<\\n",
	termRegExp: /(^<<<(\n|$))/mg,
	element: "blockquote",
	handler: config.formatterHelpers.createElementAndWikify
},

{
	name: "quoteByLine",
	match: "^>+",
	lookaheadRegExp: /^>+/mg,
	termRegExp: /(\n)/mg,
	element: "blockquote",
	handler: function(w)
	{
		var stack = [w.output];
		var currLevel = 0;
		var newLevel = w.matchLength;
		var t;
		do {
			if(newLevel > currLevel) {
				for(t=currLevel; t<newLevel; t++)
					stack.push(createTiddlyElement(stack[stack.length-1],this.element));
			} else if(newLevel < currLevel) {
				for(t=currLevel; t>newLevel; t--)
					stack.pop();
			}
			currLevel = newLevel;
			w.subWikifyTerm(stack[stack.length-1],this.termRegExp);
			createTiddlyElement(stack[stack.length-1],"br");
			this.lookaheadRegExp.lastIndex = w.nextMatch;
			var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
			var matched = lookaheadMatch && lookaheadMatch.index == w.nextMatch;
			if(matched) {
				newLevel = lookaheadMatch[0].length;
				w.nextMatch += lookaheadMatch[0].length;
			}
		} while(matched);
	}
},

{
	name: "rule",
	match: "^----+$\\n?|<hr ?/?>\\n?",
	handler: function(w)
	{
		createTiddlyElement(w.output,"hr");
	}
},

{
	name: "monospacedByLine",
	match: "^(?:/\\*\\{\\{\\{\\*/|\\{\\{\\{|//\\{\\{\\{|<!--\\{\\{\\{-->)\\n",
	element: "pre",
	handler: function(w)
	{
		switch(w.matchText) {
		case "/*{{{*/\n": // CSS
			this.lookaheadRegExp = /\/\*\{\{\{\*\/\n*((?:^[^\n]*\n)+?)(\n*^\f*\/\*\}\}\}\*\/$\n?)/mg;
			break;
		case "{{{\n": // monospaced block
			this.lookaheadRegExp = /^\{\{\{\n((?:^[^\n]*\n)+?)(^\f*\}\}\}$\n?)/mg;
			break;
		case "//{{{\n": // plugin
			this.lookaheadRegExp = /^\/\/\{\{\{\n\n*((?:^[^\n]*\n)+?)(\n*^\f*\/\/\}\}\}$\n?)/mg;
			break;
		case "<!--{{{-->\n": //template
			this.lookaheadRegExp = /<!--\{\{\{-->\n*((?:^[^\n]*\n)+?)(\n*^\f*<!--\}\}\}-->$\n?)/mg;
			break;
		default:
			break;
		}
		config.formatterHelpers.enclosedTextHelper.call(this,w);
	}
},

{
	name: "wikifyComment",
	match: "^(?:/\\*\\*\\*|<!---)\\n",
	handler: function(w)
	{
		var termRegExp = (w.matchText == "/***\n") ? (/(^\*\*\*\/\n)/mg) : (/(^--->\n)/mg);
		w.subWikifyTerm(w.output,termRegExp);
	}
},

{
	name: "macro",
	match: "<<",
	lookaheadRegExp: /<<([^>\s]+)(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart && lookaheadMatch[1]) {
			w.nextMatch = this.lookaheadRegExp.lastIndex;
			invokeMacro(w.output,lookaheadMatch[1],lookaheadMatch[2],w,w.tiddler);
		}
	}
},

{
	name: "prettyLink",
	match: "\\[\\[",
	lookaheadRegExp: /\[\[(.*?)(?:\|(~)?(.*?))?\]\]/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var e;
			var text = lookaheadMatch[1];
			if(lookaheadMatch[3]) {
				// Pretty bracketted link
				var link = lookaheadMatch[3];
				e = (!lookaheadMatch[2] && config.formatterHelpers.isExternalLink(link)) ?
						createExternalLink(w.output,link) : createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler);
			} else {
				// Simple bracketted link
				e = createTiddlyLink(w.output,text,false,null,w.isStatic,w.tiddler);
			}
			createTiddlyText(e,text);
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: "wikiLink",
	match: config.textPrimitives.unWikiLink+"?"+config.textPrimitives.wikiLink,
	handler: function(w)
	{
		if(w.matchText.substr(0,1) == config.textPrimitives.unWikiLink) {
			w.outputText(w.output,w.matchStart+1,w.nextMatch);
			return;
		}
		if(w.matchStart > 0) {
			var preRegExp = new RegExp(config.textPrimitives.anyLetterStrict,"mg");
			preRegExp.lastIndex = w.matchStart-1;
			var preMatch = preRegExp.exec(w.source);
			if(preMatch.index == w.matchStart-1) {
				w.outputText(w.output,w.matchStart,w.nextMatch);
				return;
			}
		}
		if(w.autoLinkWikiWords || store.isShadowTiddler(w.matchText)) {
			var link = createTiddlyLink(w.output,w.matchText,false,null,w.isStatic,w.tiddler);
			w.outputText(link,w.matchStart,w.nextMatch);
		} else {
			w.outputText(w.output,w.matchStart,w.nextMatch);
		}
	}
},

{
	name: "urlLink",
	match: config.textPrimitives.urlPattern,
	handler: function(w)
	{
		w.outputText(createExternalLink(w.output,w.matchText),w.matchStart,w.nextMatch);
	}
},

{
	name: "image",
	match: "\\[[<>]?[Ii][Mm][Gg]\\[",
	lookaheadRegExp: /\[([<]?)(>?)[Ii][Mm][Gg]\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var e = w.output;
			if(lookaheadMatch[5]) {
				var link = lookaheadMatch[5];
				e = config.formatterHelpers.isExternalLink(link) ? createExternalLink(w.output,link) : createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler);
				addClass(e,"imageLink");
			}
			var img = createTiddlyElement(e,"img");
			if(lookaheadMatch[1])
				img.align = "left";
			else if(lookaheadMatch[2])
				img.align = "right";
			if(lookaheadMatch[3]) {
				img.title = lookaheadMatch[3];
				img.setAttribute("alt",lookaheadMatch[3]);
			}
			img.src = lookaheadMatch[4];
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: "html",
	match: "<[Hh][Tt][Mm][Ll]>",
	lookaheadRegExp: /<[Hh][Tt][Mm][Ll]>((?:.|\n)*?)<\/[Hh][Tt][Mm][Ll]>/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			createTiddlyElement(w.output,"span").innerHTML = lookaheadMatch[1];
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: "commentByBlock",
	match: "/%",
	lookaheadRegExp: /\/%((?:.|\n)*?)%\//mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart)
			w.nextMatch = this.lookaheadRegExp.lastIndex;
	}
},

{
	name: "characterFormat",
	match: "''|//|__|\\^\\^|~~|--(?!\\s|$)|\\{\\{\\{",
	handler: function(w)
	{
		switch(w.matchText) {
		case "''":
			w.subWikifyTerm(w.output.appendChild(document.createElement("strong")),/('')/mg);
			break;
		case "//":
			w.subWikifyTerm(createTiddlyElement(w.output,"em"),/(\/\/)/mg);
			break;
		case "__":
			w.subWikifyTerm(createTiddlyElement(w.output,"u"),/(__)/mg);
			break;
		case "^^":
			w.subWikifyTerm(createTiddlyElement(w.output,"sup"),/(\^\^)/mg);
			break;
		case "~~":
			w.subWikifyTerm(createTiddlyElement(w.output,"sub"),/(~~)/mg);
			break;
		case "--":
			w.subWikifyTerm(createTiddlyElement(w.output,"strike"),/(--)/mg);
			break;
		case "{{{":
			var lookaheadRegExp = /\{\{\{((?:.|\n)*?)\}\}\}/mg;
			lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = lookaheadRegExp.exec(w.source);
			if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
				createTiddlyElement(w.output,"code",null,null,lookaheadMatch[1]);
				w.nextMatch = lookaheadRegExp.lastIndex;
			}
			break;
		}
	}
},

{
	name: "customFormat",
	match: "@@|\\{\\{",
	handler: function(w)
	{
		switch(w.matchText) {
		case "@@":
			var e = createTiddlyElement(w.output,"span");
			var styles = config.formatterHelpers.inlineCssHelper(w);
			if(styles.length == 0)
				e.className = "marked";
			else
				config.formatterHelpers.applyCssHelper(e,styles);
			w.subWikifyTerm(e,/(@@)/mg);
			break;
		case "{{":
			var lookaheadRegExp = /\{\{[\s]*([\w]+[\s\w]*)[\s]*\{(\n?)/mg;
			lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = lookaheadRegExp.exec(w.source);
			if(lookaheadMatch) {
				w.nextMatch = lookaheadRegExp.lastIndex;
				e = createTiddlyElement(w.output,lookaheadMatch[2] == "\n" ? "div" : "span",null,lookaheadMatch[1]);
				w.subWikifyTerm(e,/(\}\}\})/mg);
			}
			break;
		}
	}
},

{
	name: "mdash",
	match: "--",
	handler: function(w)
	{
		createTiddlyElement(w.output,"span").innerHTML = "&mdash;";
	}
},

{
	name: "lineBreak",
	match: "\\n|<br ?/?>",
	handler: function(w)
	{
		createTiddlyElement(w.output,"br");
	}
},

{
	name: "rawText",
	match: "\"{3}|<nowiki>",
	lookaheadRegExp: /(?:\"{3}|<nowiki>)((?:.|\n)*?)(?:\"{3}|<\/nowiki>)/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			createTiddlyElement(w.output,"span",null,null,lookaheadMatch[1]);
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: "htmlEntitiesEncoding",
	match: "(?:(?:&#?[a-zA-Z0-9]{2,8};|.)(?:&#?(?:x0*(?:3[0-6][0-9a-fA-F]|1D[c-fC-F][0-9a-fA-F]|20[d-fD-F][0-9a-fA-F]|FE2[0-9a-fA-F])|0*(?:76[89]|7[7-9][0-9]|8[0-7][0-9]|761[6-9]|76[2-7][0-9]|84[0-3][0-9]|844[0-7]|6505[6-9]|6506[0-9]|6507[0-1]));)+|&#?[a-zA-Z0-9]{2,8};)",
	handler: function(w)
	{
		createTiddlyElement(w.output,"span").innerHTML = w.matchText;
	}
}

];

//--
//-- Wikifier
//--

function getParser(tiddler,format)
{
	if(tiddler) {
		if(!format)
			format = tiddler.fields["wikiformat"];
		var i;
		if(format) {
			for(i in config.parsers) {
				if(format == config.parsers[i].format)
					return config.parsers[i];
			}
		} else {
			for(i in config.parsers) {
				if(tiddler.isTagged(config.parsers[i].formatTag))
					return config.parsers[i];
			}
		}
	}
	return formatter;
}

function wikify(source,output,highlightRegExp,tiddler)
{
	if(source) {
		var wikifier = new Wikifier(source,getParser(tiddler),highlightRegExp,tiddler);
		var t0 = new Date();
		wikifier.subWikify(output);
		if(tiddler && config.options.chkDisplayInstrumentation)
			displayMessage("wikify:" +tiddler.title+ " in " + (new Date()-t0) + " ms");
	}
}

function wikifyStatic(source,highlightRegExp,tiddler,format)
{
	var e = createTiddlyElement(document.body,"pre");
	e.style.display = "none";
	var html = "";
	if(source && source != "") {
		if(!tiddler)
			tiddler = new Tiddler("temp");
		var wikifier = new Wikifier(source,getParser(tiddler,format),highlightRegExp,tiddler);
		wikifier.isStatic = true;
		wikifier.subWikify(e);
		html = e.innerHTML;
		removeNode(e);
	}
	return html;
}

function wikifyPlain(title,theStore,limit)
{
	if(!theStore)
		theStore = store;
	if(theStore.tiddlerExists(title) || theStore.isShadowTiddler(title)) {
		return wikifyPlainText(theStore.getTiddlerText(title),limit,tiddler);
	} else {
		return "";
	}
}

function wikifyPlainText(text,limit,tiddler)
{
	if(limit > 0)
		text = text.substr(0,limit);
	var wikifier = new Wikifier(text,formatter,null,tiddler);
	return wikifier.wikifyPlain();
}

function highlightify(source,output,highlightRegExp,tiddler)
{
	if(source) {
		var wikifier = new Wikifier(source,formatter,highlightRegExp,tiddler);
		wikifier.outputText(output,0,source.length);
	}
}

function Wikifier(source,formatter,highlightRegExp,tiddler)
{
	this.source = source;
	this.output = null;
	this.formatter = formatter;
	this.nextMatch = 0;
	this.autoLinkWikiWords = tiddler && tiddler.autoLinkWikiWords() == false ? false : true;
	this.highlightRegExp = highlightRegExp;
	this.highlightMatch = null;
	this.isStatic = false;
	if(highlightRegExp) {
		highlightRegExp.lastIndex = 0;
		this.highlightMatch = highlightRegExp.exec(source);
	}
	this.tiddler = tiddler;
}

Wikifier.prototype.wikifyPlain = function()
{
	var e = createTiddlyElement(document.body,"div");
	e.style.display = "none";
	this.subWikify(e);
	var text = getPlainText(e);
	removeNode(e);
	return text;
};

Wikifier.prototype.subWikify = function(output,terminator)
{
	try {
		if(terminator)
			this.subWikifyTerm(output,new RegExp("(" + terminator + ")","mg"));
		else
			this.subWikifyUnterm(output);
	} catch(ex) {
		showException(ex);
	}
};

Wikifier.prototype.subWikifyUnterm = function(output)
{
	var oldOutput = this.output;
	this.output = output;
	this.formatter.formatterRegExp.lastIndex = this.nextMatch;
	var formatterMatch = this.formatter.formatterRegExp.exec(this.source);
	while(formatterMatch) {
		// Output any text before the match
		if(formatterMatch.index > this.nextMatch)
			this.outputText(this.output,this.nextMatch,formatterMatch.index);
		// Set the match parameters for the handler
		this.matchStart = formatterMatch.index;
		this.matchLength = formatterMatch[0].length;
		this.matchText = formatterMatch[0];
		this.nextMatch = this.formatter.formatterRegExp.lastIndex;
		for(var t=1; t<formatterMatch.length; t++) {
			if(formatterMatch[t]) {
				this.formatter.formatters[t-1].handler(this);
				this.formatter.formatterRegExp.lastIndex = this.nextMatch;
				break;
			}
		}
		formatterMatch = this.formatter.formatterRegExp.exec(this.source);
	}
	if(this.nextMatch < this.source.length) {
		this.outputText(this.output,this.nextMatch,this.source.length);
		this.nextMatch = this.source.length;
	}
	this.output = oldOutput;
};

Wikifier.prototype.subWikifyTerm = function(output,terminatorRegExp)
{
	var oldOutput = this.output;
	this.output = output;
	terminatorRegExp.lastIndex = this.nextMatch;
	var terminatorMatch = terminatorRegExp.exec(this.source);
	this.formatter.formatterRegExp.lastIndex = this.nextMatch;
	var formatterMatch = this.formatter.formatterRegExp.exec(terminatorMatch ? this.source.substr(0,terminatorMatch.index) : this.source);
	while(terminatorMatch || formatterMatch) {
		if(terminatorMatch && (!formatterMatch || terminatorMatch.index <= formatterMatch.index)) {
			if(terminatorMatch.index > this.nextMatch)
				this.outputText(this.output,this.nextMatch,terminatorMatch.index);
			this.matchText = terminatorMatch[1];
			this.matchLength = terminatorMatch[1].length;
			this.matchStart = terminatorMatch.index;
			this.nextMatch = this.matchStart + this.matchLength;
			this.output = oldOutput;
			return;
		}
		if(formatterMatch.index > this.nextMatch)
			this.outputText(this.output,this.nextMatch,formatterMatch.index);
		this.matchStart = formatterMatch.index;
		this.matchLength = formatterMatch[0].length;
		this.matchText = formatterMatch[0];
		this.nextMatch = this.formatter.formatterRegExp.lastIndex;
		for(var t=1; t<formatterMatch.length; t++) {
			if(formatterMatch[t]) {
				this.formatter.formatters[t-1].handler(this);
				this.formatter.formatterRegExp.lastIndex = this.nextMatch;
				break;
			}
		}
		terminatorRegExp.lastIndex = this.nextMatch;
		terminatorMatch = terminatorRegExp.exec(this.source);
		formatterMatch = this.formatter.formatterRegExp.exec(terminatorMatch ? this.source.substr(0,terminatorMatch.index) : this.source);
	}
	if(this.nextMatch < this.source.length) {
		this.outputText(this.output,this.nextMatch,this.source.length);
		this.nextMatch = this.source.length;
	}
	this.output = oldOutput;
};

Wikifier.prototype.outputText = function(place,startPos,endPos)
{
	while(this.highlightMatch && (this.highlightRegExp.lastIndex > startPos) && (this.highlightMatch.index < endPos) && (startPos < endPos)) {
		if(this.highlightMatch.index > startPos) {
			createTiddlyText(place,this.source.substring(startPos,this.highlightMatch.index));
			startPos = this.highlightMatch.index;
		}
		var highlightEnd = Math.min(this.highlightRegExp.lastIndex,endPos);
		var theHighlight = createTiddlyElement(place,"span",null,"highlight",this.source.substring(startPos,highlightEnd));
		startPos = highlightEnd;
		if(startPos >= this.highlightRegExp.lastIndex)
			this.highlightMatch = this.highlightRegExp.exec(this.source);
	}
	if(startPos < endPos) {
		createTiddlyText(place,this.source.substring(startPos,endPos));
	}
};

//--
//-- Macro definitions
//--

config.macros.today.handler = function(place,macroName,params)
{
	var now = new Date();
	var text = params[0] ? now.formatString(params[0].trim()) : now.toLocaleString();
	jQuery("<span/>").text(text).appendTo(place);
};

config.macros.version.handler = function(place)
{
	jQuery("<span/>").text(formatVersion()).appendTo(place);
};

config.macros.list.handler = function(place,macroName,params)
{
	var type = params[0] || "all";
	var list = document.createElement("ul");
	place.appendChild(list);
	if(this[type].prompt)
		createTiddlyElement(list,"li",null,"listTitle",this[type].prompt);
	var results;
	if(this[type].handler)
		results = this[type].handler(params);
	for(var t = 0; t < results.length; t++) {
		var li = document.createElement("li");
		list.appendChild(li);
		createTiddlyLink(li,typeof results[t] == "string" ? results[t] : results[t].title,true);
	}
};

config.macros.list.all.handler = function(params)
{
	return store.reverseLookup("tags","excludeLists",false,"title");
};

config.macros.list.missing.handler = function(params)
{
	return store.getMissingLinks();
};

config.macros.list.orphans.handler = function(params)
{
	return store.getOrphans();
};

config.macros.list.shadowed.handler = function(params)
{
	return store.getShadowed();
};

config.macros.list.touched.handler = function(params)
{
	return store.getTouched();
};

config.macros.list.filter.handler = function(params)
{
	var filter = params[1];
	var results = [];
	if(filter) {
		var tiddlers = store.filterTiddlers(filter);
		for(var t=0; t<tiddlers.length; t++)
			results.push(tiddlers[t].title);
	}
	return results;
};

config.macros.allTags.handler = function(place,macroName,params)
{
	var tags = store.getTags(params[0]);
	var ul = createTiddlyElement(place,"ul");
	if(tags.length == 0)
		createTiddlyElement(ul,"li",null,"listTitle",this.noTags);
	for(var t=0; t<tags.length; t++) {
		var title = tags[t][0];
		var info = getTiddlyLinkInfo(title);
		var li = createTiddlyElement(ul,"li");
		var btn = createTiddlyButton(li,title + " (" + tags[t][1] + ")",this.tooltip.format([title]),onClickTag,info.classes);
		btn.setAttribute("tag",title);
		btn.setAttribute("refresh","link");
		btn.setAttribute("tiddlyLink",title);
		if(params[1]) {
			btn.setAttribute("sortby",params[1]);
		}
	}
};

config.macros.timeline.handler = function(place,macroName,params)
{
	var field = params[0] || "modified";
	var tiddlers = store.reverseLookup("tags","excludeLists",false,field);
	var lastDay = "";
	var last = params[1] ? tiddlers.length-Math.min(tiddlers.length,parseInt(params[1])) : 0;
	var dateFormat = params[2] || this.dateFormat;
	for(var t=tiddlers.length-1; t>=last; t--) {
		var tiddler = tiddlers[t];
		var theDay = tiddler[field].convertToLocalYYYYMMDDHHMM().substr(0,8);
		if(theDay != lastDay) {
			var ul = document.createElement("ul");
			addClass(ul,"timeline");
			place.appendChild(ul);
			createTiddlyElement(ul,"li",null,"listTitle",tiddler[field].formatString(dateFormat));
			lastDay = theDay;
		}
		createTiddlyElement(ul,"li",null,"listLink").appendChild(createTiddlyLink(place,tiddler.title,true));
	}
};

config.macros.tiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	var allowEval = true;
	var stack = config.macros.tiddler.tiddlerStack;
	if(stack.length > 0 && config.evaluateMacroParameters == "system") {
		// included tiddler and "system" evaluation required, so check tiddler tagged appropriately
		var title = stack[stack.length-1];
		var pos = title.indexOf(config.textPrimitives.sectionSeparator);
		if(pos != -1) {
			title = title.substr(0,pos); // get the base tiddler title
		}
		var t = store.getTiddler(title);
		if(!t || t.tags.indexOf("systemAllowEval") == -1) {
			allowEval = false;
		}
	}
	params = paramString.parseParams("name",null,allowEval,false,true);
	var names = params[0]["name"];
	var tiddlerName = names[0];
	var className = names[1] || null;
	var args = params[0]["with"];
	var wrapper = createTiddlyElement(place,"span",null,className,null,{
		refresh: "content", tiddler: tiddlerName
	});
	if(args!==undefined)
		wrapper.setAttribute("args","[["+args.join("]] [[")+"]]");
	this.transclude(wrapper,tiddlerName,args);
};

config.macros.tiddler.transclude = function(wrapper,tiddlerName,args)
{
	var text = store.getTiddlerText(tiddlerName);
	if(!text)
		return;
	var stack = config.macros.tiddler.tiddlerStack;
	if(stack.indexOf(tiddlerName) !== -1)
		return;
	stack.push(tiddlerName);
	try {
		if(typeof args == "string")
			args = args.readBracketedList();
		var n = args ? Math.min(args.length,9) : 0;
		for(var i=0; i<n; i++) {
			var placeholderRE = new RegExp("\\$" + (i + 1),"mg");
			text = text.replace(placeholderRE,args[i]);
		}
		config.macros.tiddler.renderText(wrapper,text,tiddlerName,params);
	} finally {
		stack.pop();
	}
};

config.macros.tiddler.renderText = function(place,text,tiddlerName,params)
{
	wikify(text,place,null,store.getTiddler(tiddlerName));
};

config.macros.tiddler.tiddlerStack = [];

config.macros.tag.handler = function(place,macroName,params)
{
	createTagButton(place,params[0],null,params[1],params[2]);
	if(params[3]) {
		btn.setAttribute('sortby',params[3]);
	}
};

config.macros.tags.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	params = paramString.parseParams("anon",null,true,false,false);
	var ul = createTiddlyElement(place,"ul");
	var title = getParam(params,"anon","");
	if(title && store.tiddlerExists(title))
		tiddler = store.getTiddler(title);
	var sep = getParam(params,"sep"," ");
	var lingo = config.views.wikified.tag;
	var label = null;
	for(var t=0; t<tiddler.tags.length; t++) {
		var tag = store.getTiddler(tiddler.tags[t]);
		if(!tag || !tag.tags.contains("excludeLists")) {
			if(!label)
				label = createTiddlyElement(ul,"li",null,"listTitle",lingo.labelTags.format([tiddler.title]));
			createTagButton(createTiddlyElement(ul,"li"),tiddler.tags[t],tiddler.title);
			if(t<tiddler.tags.length-1)
				createTiddlyText(ul,sep);
		}
	}
	if(!label)
		createTiddlyElement(ul,"li",null,"listTitle",lingo.labelNoTags.format([tiddler.title]));
};

config.macros.tagging.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	params = paramString.parseParams("anon",null,true,false,false);
	var ul = createTiddlyElement(place,"ul");
	var title = getParam(params,"anon","");
	if(title == "" && tiddler instanceof Tiddler)
		title = tiddler.title;
	var sep = getParam(params,"sep"," ");
	ul.setAttribute("title",this.tooltip.format([title]));
	var tagged = store.getTaggedTiddlers(title);
	var prompt = tagged.length == 0 ? this.labelNotTag : this.label;
	createTiddlyElement(ul,"li",null,"listTitle",prompt.format([title,tagged.length]));
	for(var t=0; t<tagged.length; t++) {
		createTiddlyLink(createTiddlyElement(ul,"li"),tagged[t].title,true);
		if(t<tagged.length-1)
			createTiddlyText(ul,sep);
	}
};

config.macros.closeAll.handler = function(place)
{
	createTiddlyButton(place,this.label,this.prompt,this.onClick);
};

config.macros.closeAll.onClick = function(e)
{
	story.closeAllTiddlers();
	return false;
};

config.macros.permaview.handler = function(place)
{
	createTiddlyButton(place,this.label,this.prompt,this.onClick);
};

config.macros.permaview.onClick = function(e)
{
	story.permaView();
	return false;
};

config.macros.saveChanges.handler = function(place,macroName,params)
{
	if(!readOnly)
		createTiddlyButton(place,params[0] || this.label,params[1] || this.prompt,this.onClick,null,null,this.accessKey);
};

config.macros.saveChanges.onClick = function(e)
{
	saveChanges();
	return false;
};

config.macros.slider.onClickSlider = function(ev)
{
	var e = ev || window.event;
	var n = this.nextSibling;
	var cookie = n.getAttribute("cookie");
	var isOpen = n.style.display != "none";
	if(config.options.chkAnimate && anim && typeof Slider == "function")
		anim.startAnimating(new Slider(n,!isOpen,null,"none"));
	else
		n.style.display = isOpen ? "none" : "block";
	config.options[cookie] = !isOpen;
	saveOption(cookie);
	return false;
};

config.macros.slider.createSlider = function(place,cookie,title,tooltip)
{
	var c = cookie || "";
	var btn = createTiddlyButton(place,title,tooltip,this.onClickSlider);
	var panel = createTiddlyElement(null,"div",null,"sliderPanel");
	panel.setAttribute("cookie",c);
	panel.style.display = config.options[c] ? "block" : "none";
	place.appendChild(panel);
	return panel;
};

config.macros.slider.handler = function(place,macroName,params)
{
	var panel = this.createSlider(place,params[0],params[2],params[3]);
	var text = store.getTiddlerText(params[1]);
	panel.setAttribute("refresh","content");
	panel.setAttribute("tiddler",params[1]);
	if(text)
		wikify(text,panel,null,store.getTiddler(params[1]));
};

// <<gradient [[tiddler name]] vert|horiz rgb rgb rgb rgb... >>
config.macros.gradient.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	var panel = wikifier ? createTiddlyElement(place,"div",null,"gradient") : place;
	panel.style.position = "relative";
	panel.style.overflow = "hidden";
	panel.style.zIndex = "0";
	if(wikifier) {
		var styles = config.formatterHelpers.inlineCssHelper(wikifier);
		config.formatterHelpers.applyCssHelper(panel,styles);
	}
	params = paramString.parseParams("color");
	var locolors = [], hicolors = [];
	for(var t=2; t<params.length; t++) {
		var c = params[t].value;
		if(params[t].name == "snap") {
			hicolors[hicolors.length-1] = c;
		} else {
			locolors.push(c);
			hicolors.push(c);
		}
	}
	drawGradient(panel,params[1].value != "vert",locolors,hicolors);
	if(wikifier)
		wikifier.subWikify(panel,">>");
	if(document.all) {
		panel.style.height = "100%";
		panel.style.width = "100%";
	}
};

config.macros.message.handler = function(place,macroName,params)
{
	if(params[0]) {
		var names = params[0].split(".");
		var lookupMessage = function(root,nameIndex) {
				if(names[nameIndex] in root) {
					if(nameIndex < names.length-1)
						return (lookupMessage(root[names[nameIndex]],nameIndex+1));
					else
						return root[names[nameIndex]];
				} else
					return null;
			};
		var m = lookupMessage(config,0);
		if(m == null)
			m = lookupMessage(window,0);
		createTiddlyText(place,m.toString().format(params.splice(1)));
	}
};


config.macros.view.depth = 0;
config.macros.view.views = {
	text: function(value,place,params,wikifier,paramString,tiddler) {
		highlightify(value,place,highlightHack,tiddler);
	},
	link: function(value,place,params,wikifier,paramString,tiddler) {
		createTiddlyLink(place,value,true);
	},
	wikified: function(value,place,params,wikifier,paramString,tiddler) {
		if(config.macros.view.depth>50)
			return;
		config.macros.view.depth++;
		if(params[2])
			value=params[2].unescapeLineBreaks().format([value]);
		wikify(value,place,highlightHack,tiddler);
		config.macros.view.depth--;
	},
	date: function(value,place,params,wikifier,paramString,tiddler) {
		value = Date.convertFromYYYYMMDDHHMM(value);
		createTiddlyText(place,value.formatString(params[2] ? params[2] : config.views.wikified.dateFormat));
	}
};

config.macros.view.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	if((tiddler instanceof Tiddler) && params[0]) {
		var value = store.getValue(tiddler,params[0]);
		if(value) {
			var type = params[1] || config.macros.view.defaultView;
			var handler = config.macros.view.views[type];
			if(handler)
				handler(value,place,params,wikifier,paramString,tiddler);
		}
	}
};

config.macros.edit.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	var field = params[0];
	var rows = params[1] || 0;
	var defVal = params[2] || '';
	if((tiddler instanceof Tiddler) && field) {
		story.setDirty(tiddler.title,true);
		var e,v;
		if(field != "text" && !rows) {
			e = createTiddlyElement(null,"input",null,null,null,{
				type: "text", edit: field, size: "40", autocomplete: "off"
			});
			e.value = store.getValue(tiddler,field) || defVal;
			place.appendChild(e);
		} else {
			var wrapper1 = createTiddlyElement(null,"fieldset",null,"fieldsetFix");
			var wrapper2 = createTiddlyElement(wrapper1,"div");
			e = createTiddlyElement(wrapper2,"textarea");
			e.value = v = store.getValue(tiddler,field) || defVal;
			rows = rows || 10;
			var lines = v.match(/\n/mg);
			var maxLines = Math.max(parseInt(config.options.txtMaxEditRows),5);
			if(lines != null && lines.length > rows)
				rows = lines.length + 5;
			rows = Math.min(rows,maxLines);
			e.setAttribute("rows",rows);
			e.setAttribute("edit",field);
			place.appendChild(wrapper1);
		}
		if(tiddler.isReadOnly()) {
			e.setAttribute("readOnly","readOnly");
			addClass(e,"readOnly");
		}
		return e;
	}
};

config.macros.tagChooser.onClick = function(ev)
{
	var e = ev || window.event;
	var lingo = config.views.editor.tagChooser;
	var popup = Popup.create(this);
	var tags = store.getTags(this.getAttribute("tags"));
	if(tags.length == 0)
		jQuery("<li/>").text(lingo.popupNone).appendTo(popup);
	for(var t=0; t<tags.length; t++) {
		var tag = createTiddlyButton(createTiddlyElement(popup,"li"),tags[t][0],lingo.tagTooltip.format([tags[t][0]]),config.macros.tagChooser.onTagClick);
		tag.setAttribute("tag",tags[t][0]);
		tag.setAttribute("tiddler",this.getAttribute("tiddler"));
	}
	Popup.show();
	e.cancelBubble = true;
	if(e.stopPropagation) e.stopPropagation();
	return false;
};

config.macros.tagChooser.onTagClick = function(ev)
{
	var e = ev || window.event;
	if(e.metaKey || e.ctrlKey) stopEvent(e); //# keep popup open on CTRL-click
	var tag = this.getAttribute("tag");
	var title = this.getAttribute("tiddler");
	if(!readOnly)
		story.setTiddlerTag(title,tag,0);
	return false;
};

config.macros.tagChooser.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	if(tiddler instanceof Tiddler) {
		var lingo = config.views.editor.tagChooser;
		var btn = createTiddlyButton(place,lingo.text,lingo.tooltip,this.onClick);
		btn.setAttribute("tiddler",tiddler.title);
		btn.setAttribute("tags",params[0]);
	}
};

config.macros.refreshDisplay.handler = function(place)
{
	createTiddlyButton(place,this.label,this.prompt,this.onClick);
};

config.macros.refreshDisplay.onClick = function(e)
{
	refreshAll();
	return false;
};

config.macros.annotations.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	var title = tiddler ? tiddler.title : null;
	var a = title ? config.annotations[title] : null;
	if(!tiddler || !title || !a)
		return;
	var text = a.format([title]);
	wikify(text,createTiddlyElement(place,"div",null,"annotation"),null,tiddler);
};

//--
//-- NewTiddler and NewJournal macros
//--

config.macros.newTiddler.createNewTiddlerButton = function(place,title,params,label,prompt,accessKey,newFocus,isJournal)
{
	var tags = [];
	for(var t=1; t<params.length; t++) {
		if((params[t].name == "anon" && t != 1) || (params[t].name == "tag"))
			tags.push(params[t].value);
	}
	label = getParam(params,"label",label);
	prompt = getParam(params,"prompt",prompt);
	accessKey = getParam(params,"accessKey",accessKey);
	newFocus = getParam(params,"focus",newFocus);
	var customFields = getParam(params,"fields","");
	if(!customFields && !store.isShadowTiddler(title))
		customFields = String.encodeHashMap(config.defaultCustomFields);
	var btn = createTiddlyButton(place,label,prompt,this.onClickNewTiddler,null,null,accessKey);
	btn.setAttribute("newTitle",title);
	btn.setAttribute("isJournal",isJournal ? "true" : "false");
	if(tags.length > 0)
		btn.setAttribute("params",tags.join("|"));
	btn.setAttribute("newFocus",newFocus);
	btn.setAttribute("newTemplate",getParam(params,"template",DEFAULT_EDIT_TEMPLATE));
	if(customFields !== "")
		btn.setAttribute("customFields",customFields);
	var text = getParam(params,"text");
	if(text !== undefined)
		btn.setAttribute("newText",text);
	return btn;
};

config.macros.newTiddler.onClickNewTiddler = function()
{
	var title = this.getAttribute("newTitle");
	if(this.getAttribute("isJournal") == "true") {
		title = new Date().formatString(title.trim());
	}
	var params = this.getAttribute("params");
	var tags = params ? params.split("|") : [];
	var focus = this.getAttribute("newFocus");
	var template = this.getAttribute("newTemplate");
	var customFields = this.getAttribute("customFields");
	if(!customFields && !store.isShadowTiddler(title))
		customFields = String.encodeHashMap(config.defaultCustomFields);
	story.displayTiddler(null,title,template,false,null,null);
	var tiddlerElem = story.getTiddler(title);
	if(customFields)
		story.addCustomFields(tiddlerElem,customFields);
	var text = this.getAttribute("newText");
	if(typeof text == "string" && story.getTiddlerField(title,"text"))
		story.getTiddlerField(title,"text").value = text.format([title]);
	for(var t=0;t<tags.length;t++)
		story.setTiddlerTag(title,tags[t],+1);
	story.focusTiddler(title,focus);
	return false;
};

config.macros.newTiddler.handler = function(place,macroName,params,wikifier,paramString)
{
	if(!readOnly) {
		params = paramString.parseParams("anon",null,true,false,false);
		var title = params[1] && params[1].name == "anon" ? params[1].value : this.title;
		title = getParam(params,"title",title);
		this.createNewTiddlerButton(place,title,params,this.label,this.prompt,this.accessKey,"title",false);
	}
};

config.macros.newJournal.handler = function(place,macroName,params,wikifier,paramString)
{
	if(!readOnly) {
		params = paramString.parseParams("anon",null,true,false,false);
		var title = params[1] && params[1].name == "anon" ? params[1].value : config.macros.timeline.dateFormat;
		title = getParam(params,"title",title);
		config.macros.newTiddler.createNewTiddlerButton(place,title,params,this.label,this.prompt,this.accessKey,"text",true);
	}
};

//--
//-- Search macro
//--

config.macros.search.handler = function(place,macroName,params)
{
	var searchTimeout = null;
	var btn = createTiddlyButton(place,this.label,this.prompt,this.onClick,"searchButton");
	var txt = createTiddlyElement(null,"input",null,"txtOptionInput searchField");
	if(params[0]) {
		txt.value = params[0];
	}
	if(config.browser.isSafari) {
		txt.setAttribute("type","search");
		txt.setAttribute("results","5");
	} else {
		txt.setAttribute("type","text");
	}
	place.appendChild(txt);
	txt.onkeyup = this.onKeyPress;
	txt.onfocus = this.onFocus;
	txt.setAttribute("size",this.sizeTextbox);
	txt.setAttribute("accessKey",params[1] || this.accessKey);
	txt.setAttribute("autocomplete","off");
	txt.setAttribute("lastSearchText","");
};

// Global because there's only ever one outstanding incremental search timer
config.macros.search.timeout = null;

config.macros.search.doSearch = function(txt)
{
	if(txt.value.length > 0) {
		story.search(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);
		txt.setAttribute("lastSearchText",txt.value);
	}
};

config.macros.search.onClick = function(e)
{
	config.macros.search.doSearch(this.nextSibling);
	return false;
};

config.macros.search.onKeyPress = function(ev)
{
	var me = config.macros.search;
	var e = ev || window.event;
	switch(e.keyCode) {
		case 9: // Tab
			return;
		case 13: // Ctrl-Enter
		case 10: // Ctrl-Enter on IE PC
			me.doSearch(this);
			break;
		case 27: // Escape
			this.value = "";
			clearMessage();
			break;
	}
	if(config.options.chkIncrementalSearch) {
		if(this.value.length > 2) {
			if(this.value != this.getAttribute("lastSearchText")) {
				if(me.timeout) {
					clearTimeout(me.timeout);
				}
				var txt = this;
				me.timeout = setTimeout(function() {me.doSearch(txt);},500);
			}
		} else {
			if(me.timeout) {
				clearTimeout(me.timeout);
			}
		}
	}
};

config.macros.search.onFocus = function(e)
{
	this.select();
};

//--
//-- Tabs macro
//--

config.macros.tabs.handler = function(place,macroName,params)
{
	var cookie = params[0];
	var numTabs = (params.length-1)/3;
	var wrapper = createTiddlyElement(null,"div",null,"tabsetWrapper " + cookie);
	var tabset = createTiddlyElement(wrapper,"div",null,"tabset");
	tabset.setAttribute("cookie",cookie);
	var validTab = false;
	for(var t=0; t<numTabs; t++) {
		var label = params[t*3+1];
		var prompt = params[t*3+2];
		var content = params[t*3+3];
		var tab = createTiddlyButton(tabset,label,prompt,this.onClickTab,"tab tabUnselected");
		createTiddlyElement(tab,"span",null,null," ",{style:"font-size:0pt;line-height:0px"});
		tab.setAttribute("tab",label);
		tab.setAttribute("content",content);
		tab.title = prompt;
		if(config.options[cookie] == label)
			validTab = true;
	}
	if(!validTab)
		config.options[cookie] = params[1];
	place.appendChild(wrapper);
	this.switchTab(tabset,config.options[cookie]);
};

config.macros.tabs.onClickTab = function(e)
{
	config.macros.tabs.switchTab(this.parentNode,this.getAttribute("tab"));
	return false;
};

config.macros.tabs.switchTab = function(tabset,tab)
{
	var cookie = tabset.getAttribute("cookie");
	var theTab = null;
	var nodes = tabset.childNodes;
	for(var t=0; t<nodes.length; t++) {
		if(nodes[t].getAttribute && nodes[t].getAttribute("tab") == tab) {
			theTab = nodes[t];
			theTab.className = "tab tabSelected";
		} else {
			nodes[t].className = "tab tabUnselected";
		}
	}
	if(theTab) {
		if(tabset.nextSibling && tabset.nextSibling.className == "tabContents")
			removeNode(tabset.nextSibling);
		var tabContent = createTiddlyElement(null,"div",null,"tabContents");
		tabset.parentNode.insertBefore(tabContent,tabset.nextSibling);
		var contentTitle = theTab.getAttribute("content");
		wikify(store.getTiddlerText(contentTitle),tabContent,null,store.getTiddler(contentTitle));
		if(cookie) {
			config.options[cookie] = tab;
			saveOption(cookie);
		}
	}
};

//--
//-- Tiddler toolbar
//--

// Create a toolbar command button
config.macros.toolbar.createCommand = function(place,commandName,tiddler,className)
{
	if(typeof commandName != "string") {
		var c = null;
		for(var t in config.commands) {
			if(config.commands[t] == commandName)
				c = t;
		}
		commandName = c;
	}
	if((tiddler instanceof Tiddler) && (typeof commandName == "string")) {
		var command = config.commands[commandName];
		if(command.isEnabled ? command.isEnabled(tiddler) : this.isCommandEnabled(command,tiddler)) {
			var text = command.getText ? command.getText(tiddler) : this.getCommandText(command,tiddler);
			var tooltip = command.getTooltip ? command.getTooltip(tiddler) : this.getCommandTooltip(command,tiddler);
			var cmd;
			switch(command.type) {
			case "popup":
				cmd = this.onClickPopup;
				break;
			case "command":
			default:
				cmd = this.onClickCommand;
				break;
			}
			var btn = createTiddlyButton(null,text,tooltip,cmd);
			btn.setAttribute("commandName",commandName);
			btn.setAttribute("tiddler",tiddler.title);
			addClass(btn,"command_" + commandName);
			if(className)
				addClass(btn,className);
			place.appendChild(btn);
		}
	}
};

config.macros.toolbar.isCommandEnabled = function(command,tiddler)
{
	var title = tiddler.title;
	var ro = tiddler.isReadOnly();
	var shadow = store.isShadowTiddler(title) && !store.tiddlerExists(title);
	return (!ro || (ro && !command.hideReadOnly)) && !(shadow && command.hideShadow);
};

config.macros.toolbar.getCommandText = function(command,tiddler)
{
	return tiddler.isReadOnly() && command.readOnlyText || command.text;
};

config.macros.toolbar.getCommandTooltip = function(command,tiddler)
{
	return tiddler.isReadOnly() && command.readOnlyTooltip || command.tooltip;
};

config.macros.toolbar.onClickCommand = function(ev)
{
	var e = ev || window.event;
	e.cancelBubble = true;
	if(e.stopPropagation) e.stopPropagation();
	var command = config.commands[this.getAttribute("commandName")];
	return command.handler(e,this,this.getAttribute("tiddler"));
};

config.macros.toolbar.onClickPopup = function(ev)
{
	var e = ev || window.event;
	e.cancelBubble = true;
	if(e.stopPropagation) e.stopPropagation();
	var popup = Popup.create(this);
	var command = config.commands[this.getAttribute("commandName")];
	var title = this.getAttribute("tiddler");
	var tiddler = store.fetchTiddler(title);
	popup.setAttribute("tiddler",title);
	command.handlePopup(popup,title);
	Popup.show();
	return false;
};

// Invoke the first command encountered from a given place that is tagged with a specified class
config.macros.toolbar.invokeCommand = function(place,className,event)
{
	var children = place.getElementsByTagName("a");
	for(var t=0; t<children.length; t++) {
		var c = children[t];
		if(hasClass(c,className) && c.getAttribute && c.getAttribute("commandName")) {
			if(c.onclick instanceof Function)
				c.onclick.call(c,event);
			break;
		}
	}
};

config.macros.toolbar.onClickMore = function(ev)
{
	var e = this.nextSibling;
	e.style.display = "inline";
	this.style.display = "none";
	return false;
};

config.macros.toolbar.onClickLess = function(ev)
{
	var e = this.parentNode;
	var m = e.previousSibling;
	e.style.display = "none";
	m.style.display = "inline";
	return false;
};

config.macros.toolbar.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	for(var t=0; t<params.length; t++) {
		var c = params[t];
		switch(c) {
		case "!":
			createTiddlyText(place,this.separator);
			break;
		case "*":
			createTiddlyElement(place,"br");
			break;
		case "<":
			var btn = createTiddlyButton(place,this.lessLabel,this.lessPrompt,config.macros.toolbar.onClickLess);
			addClass(btn,"lessCommand");
			break;
		case ">":
			var btn = createTiddlyButton(place,this.moreLabel,this.morePrompt,config.macros.toolbar.onClickMore);
			addClass(btn,"moreCommand");
			var e = createTiddlyElement(place,"span",null,"moreCommand");
			e.style.display = "none";
			place = e;
			break;
		default:
			var className = "";
			switch(c.substr(0,1)) {
			case "+":
				className = "defaultCommand";
				c = c.substr(1);
				break;
			case "-":
				className = "cancelCommand";
				c = c.substr(1);
				break;
			}
			if(c in config.commands) {
				this.createCommand(place,c,tiddler,className);
			} else {
				this.customCommand(place,c,wikifier,tiddler);
			}
			break;
		}
	}
};

// Overrideable function to extend toolbar handler
config.macros.toolbar.customCommand = function(place,command,wikifier,tiddler)
{
}

//--
//-- Menu and toolbar commands
//--

config.commands.closeTiddler.handler = function(event,src,title)
{
	if(story.isDirty(title) && !readOnly) {
		if(!confirm(config.commands.cancelTiddler.warning.format([title])))
			return false;
	}
	story.setDirty(title,false);
	story.closeTiddler(title,true);
	return false;
};

config.commands.closeOthers.handler = function(event,src,title)
{
	story.closeAllTiddlers(title);
	return false;
};

config.commands.editTiddler.handler = function(event,src,title)
{
	clearMessage();
	var tiddlerElem = story.getTiddler(title);
	var fields = tiddlerElem.getAttribute("tiddlyFields");
	story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE,false,null,fields);
	var e = story.getTiddlerField(title,config.options.txtEditorFocus||"text");
	if(e) {
		setCaretPosition(e,0);
	}
	return false;
};

config.commands.saveTiddler.handler = function(event,src,title)
{
	var newTitle = story.saveTiddler(title,event.shiftKey);
	if(newTitle)
		story.displayTiddler(null,newTitle);
	return false;
};

config.commands.cancelTiddler.handler = function(event,src,title)
{
	if(story.hasChanges(title) && !readOnly) {
		if(!confirm(this.warning.format([title])))
			return false;
	}
	story.setDirty(title,false);
	story.displayTiddler(null,title);
	return false;
};

config.commands.deleteTiddler.handler = function(event,src,title)
{
	var deleteIt = true;
	if(config.options.chkConfirmDelete)
		deleteIt = confirm(this.warning.format([title]));
	if(deleteIt) {
		store.removeTiddler(title);
		story.closeTiddler(title,true);
		autoSaveChanges();
	}
	return false;
};

config.commands.permalink.handler = function(event,src,title)
{
	var t = encodeURIComponent(String.encodeTiddlyLink(title));
	if(window.location.hash != t)
		window.location.hash = t;
	return false;
};

config.commands.references.handlePopup = function(popup,title)
{
	var references = store.getReferringTiddlers(title);
	var c = false;
	for(var r=0; r<references.length; r++) {
		if(references[r].title != title && !references[r].isTagged("excludeLists")) {
			createTiddlyLink(createTiddlyElement(popup,"li"),references[r].title,true);
			c = true;
		}
	}
	if(!c)
		createTiddlyElement(popup,"li",null,"disabled",this.popupNone);
};

config.commands.jump.handlePopup = function(popup,title)
{
	story.forEachTiddler(function(title,element) {
		createTiddlyLink(createTiddlyElement(popup,"li"),title,true,null,false,null,true);
		});
};

config.commands.syncing.handlePopup = function(popup,title)
{
	var me = config.commands.syncing;
	var tiddler = store.fetchTiddler(title);
	if(!tiddler)
		return;
	var serverType = tiddler.getServerType();
	var serverHost = tiddler.fields["server.host"];
	var serverWorkspace = tiddler.fields["server.workspace"];
	if(!serverWorkspace)
		serverWorkspace = "";
	if(serverType) {
		var e = createTiddlyElement(popup,"li",null,"popupMessage");
		e.innerHTML = me.currentlySyncing.format([serverType,serverHost,serverWorkspace]);
	} else {
		createTiddlyElement(popup,"li",null,"popupMessage",me.notCurrentlySyncing);
	}
	if(serverType) {
		createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
		var btn = createTiddlyButton(createTiddlyElement(popup,"li"),this.captionUnSync,null,me.onChooseServer);
		btn.setAttribute("tiddler",title);
		btn.setAttribute("server.type","");
	}
	createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
	createTiddlyElement(popup,"li",null,"popupMessage",me.chooseServer);
	var feeds = store.getTaggedTiddlers("systemServer","title");
	for(var t=0; t<feeds.length; t++) {
		var f = feeds[t];
		var feedServerType = store.getTiddlerSlice(f.title,"Type");
		if(!feedServerType)
			feedServerType = "file";
		var feedServerHost = store.getTiddlerSlice(f.title,"URL");
		if(!feedServerHost)
			feedServerHost = "";
		var feedServerWorkspace = store.getTiddlerSlice(f.title,"Workspace");
		if(!feedServerWorkspace)
			feedServerWorkspace = "";
		var caption = f.title;
		if(serverType == feedServerType && serverHost == feedServerHost && serverWorkspace == feedServerWorkspace) {
			caption = me.currServerMarker + caption;
		} else {
			caption = me.notCurrServerMarker + caption;
		}
		btn = createTiddlyButton(createTiddlyElement(popup,"li"),caption,null,me.onChooseServer);
		btn.setAttribute("tiddler",title);
		btn.setAttribute("server.type",feedServerType);
		btn.setAttribute("server.host",feedServerHost);
		btn.setAttribute("server.workspace",feedServerWorkspace);
	}
};

config.commands.syncing.onChooseServer = function(e)
{
	var tiddler = this.getAttribute("tiddler");
	var serverType = this.getAttribute("server.type");
	if(serverType) {
		store.addTiddlerFields(tiddler,{
			"server.type": serverType,
			"server.host": this.getAttribute("server.host"),
			"server.workspace": this.getAttribute("server.workspace")
			});
	} else {
		store.setValue(tiddler,"server",null);
	}
	return false;
};

config.commands.fields.handlePopup = function(popup,title)
{
	var tiddler = store.fetchTiddler(title);
	if(!tiddler)
		return;
	var items = [];
	store.forEachField(tiddler,function(tiddler,fieldName,value){items.push({field:fieldName,value:value});},true);
	items.sort(function(a,b) {return a.field < b.field ? -1 : (a.field == b.field ? 0 : +1);});
	if(items.length > 0)
		ListView.create(popup,items,this.listViewTemplate);
	else
		createTiddlyElement(popup,"div",null,null,this.emptyText);
};

//--
//-- Tiddler() object
//--

function Tiddler(title)
{
	this.title = title;
	this.text = "";
	this.creator = null;
	this.modifier = null;
	this.created = new Date();
	this.modified = this.created;
	this.links = [];
	this.linksUpdated = false;
	this.tags = [];
	this.fields = {};
	return this;
}

Tiddler.prototype.getLinks = function()
{
	if(this.linksUpdated==false)
		this.changed();
	return this.links;
};

// Returns the fields that are inherited in string field:"value" field2:"value2" format
Tiddler.prototype.getInheritedFields = function()
{
	var f = {};
	for(var i in this.fields) {
		if(i=="server.host" || i=="server.workspace" || i=="wikiformat"|| i=="server.type") {
			f[i] = this.fields[i];
		}
	}
	return String.encodeHashMap(f);
};

// Increment the changeCount of a tiddler
Tiddler.prototype.incChangeCount = function()
{
	var c = this.fields['changecount'];
	c = c ? parseInt(c,10) : 0;
	this.fields['changecount'] = String(c+1);
};

// Clear the changeCount of a tiddler
Tiddler.prototype.clearChangeCount = function()
{
	if(this.fields['changecount']) {
		delete this.fields['changecount'];
	}
};

Tiddler.prototype.doNotSave = function()
{
	return this.fields['doNotSave'];
};

// Returns true if the tiddler has been updated since the tiddler was created or downloaded
Tiddler.prototype.isTouched = function()
{
	var changecount = this.fields.changecount || 0;
	return changecount > 0;
};

// Change the text and other attributes of a tiddler
Tiddler.prototype.set = function(title,text,modifier,modified,tags,created,fields,creator)
{
	this.assign(title,text,modifier,modified,tags,created,fields,creator);
	this.changed();
	return this;
};

// Change the text and other attributes of a tiddler without triggered a tiddler.changed() call
Tiddler.prototype.assign = function(title,text,modifier,modified,tags,created,fields,creator)
{
	if(title != undefined)
		this.title = title;
	if(text != undefined)
		this.text = text;
	if(modifier != undefined)
		this.modifier = modifier;
	if(modified != undefined)
		this.modified = modified;
	if(creator != undefined)
		this.creator = creator;
	if(created != undefined)
		this.created = created;
	if(fields != undefined)
		this.fields = fields;
	if(tags != undefined)
		this.tags = (typeof tags == "string") ? tags.readBracketedList() : tags;
	else if(this.tags == undefined)
		this.tags = [];
	return this;
};

// Get the tags for a tiddler as a string (space delimited, using [[brackets]] for tags containing spaces)
Tiddler.prototype.getTags = function()
{
	return String.encodeTiddlyLinkList(this.tags);
};

// Test if a tiddler carries a tag
Tiddler.prototype.isTagged = function(tag)
{
	return this.tags.indexOf(tag) != -1;
};

// Static method to convert "\n" to newlines, "\s" to "\"
Tiddler.unescapeLineBreaks = function(text)
{
	return text ? text.unescapeLineBreaks() : "";
};

// Convert newlines to "\n", "\" to "\s"
Tiddler.prototype.escapeLineBreaks = function()
{
	return this.text.escapeLineBreaks();
};

// Updates the secondary information (like links[] array) after a change to a tiddler
Tiddler.prototype.changed = function()
{
	this.links = [];
	var text = this.text;
	// remove 'quoted' text before scanning tiddler source
	text = text.replace(/\/%((?:.|\n)*?)%\//g,"").
		replace(/\{{3}((?:.|\n)*?)\}{3}/g,"").
		replace(/"""((?:.|\n)*?)"""/g,"").
		replace(/\<nowiki\>((?:.|\n)*?)\<\/nowiki\>/g,"").
		replace(/\<html\>((?:.|\n)*?)\<\/html\>/g,"").
		replace(/\<script((?:.|\n)*?)\<\/script\>/g,"");
	var t = this.autoLinkWikiWords() ? 0 : 1;
	var tiddlerLinkRegExp = t==0 ? config.textPrimitives.tiddlerAnyLinkRegExp : config.textPrimitives.tiddlerForcedLinkRegExp;
	tiddlerLinkRegExp.lastIndex = 0;
	var formatMatch = tiddlerLinkRegExp.exec(text);
	while(formatMatch) {
		var lastIndex = tiddlerLinkRegExp.lastIndex;
		if(t==0 && formatMatch[1] && formatMatch[1] != this.title) {
			// wikiWordLink
			if(formatMatch.index > 0) {
				var preRegExp = new RegExp(config.textPrimitives.unWikiLink+"|"+config.textPrimitives.anyLetter,"mg");
				preRegExp.lastIndex = formatMatch.index-1;
				var preMatch = preRegExp.exec(text);
				if(preMatch.index != formatMatch.index-1)
					this.links.pushUnique(formatMatch[1]);
			} else {
				this.links.pushUnique(formatMatch[1]);
			}
		}
		else if(formatMatch[2-t] && !config.formatterHelpers.isExternalLink(formatMatch[3-t])) // titledBrackettedLink
			this.links.pushUnique(formatMatch[3-t]);
		else if(formatMatch[4-t] && formatMatch[4-t] != this.title) // brackettedLink
			this.links.pushUnique(formatMatch[4-t]);
		tiddlerLinkRegExp.lastIndex = lastIndex;
		formatMatch = tiddlerLinkRegExp.exec(text);
	}
	this.linksUpdated = true;
};

Tiddler.prototype.getSubtitle = function()
{
	var modifier = this.modifier;
	if(!modifier)
		modifier = config.messages.subtitleUnknown;
	var modified = this.modified;
	if(modified)
		modified = modified.toLocaleString();
	else
		modified = config.messages.subtitleUnknown;
	return config.messages.tiddlerLinkTooltip.format([this.title,modifier,modified]);
};

Tiddler.prototype.isReadOnly = function()
{
	return readOnly;
};

Tiddler.prototype.autoLinkWikiWords = function()
{
	return !(this.isTagged("systemConfig") || this.isTagged("excludeMissing"));
};

Tiddler.prototype.getServerType = function()
{
	var serverType = null;
	if(this.fields['server.type'])
		serverType = this.fields['server.type'];
	if(!serverType)
		serverType = this.fields['wikiformat'];
	if(serverType && !config.adaptors[serverType])
		serverType = null;
	return serverType;
};

Tiddler.prototype.getAdaptor = function()
{
	var serverType = this.getServerType();
	return serverType ? new config.adaptors[serverType]() : null;
};

//--
//-- TiddlyWiki instance contains TiddlerS
//--

function TiddlyWiki()
{
	var tiddlers = {}; // Hashmap by name of tiddlers
	this.tiddlersUpdated = false;
	this.namedNotifications = []; // Array of {name:,notify:} of notification functions
	this.notificationLevel = 0;
	this.slices = {}; // map tiddlerName->(map sliceName->sliceValue). Lazy.
	this.clear = function() {
		tiddlers = {};
		this.setDirty(false);
	};
	this.fetchTiddler = function(title) {
		var t = tiddlers[title];
		return t instanceof Tiddler ? t : null;
	};
	this.deleteTiddler = function(title) {
		delete this.slices[title];
		delete tiddlers[title];
	};
	this.addTiddler = function(tiddler) {
		delete this.slices[tiddler.title];
		tiddlers[tiddler.title] = tiddler;
	};
	this.forEachTiddler = function(callback) {
		for(var t in tiddlers) {
			var tiddler = tiddlers[t];
			if(tiddler instanceof Tiddler)
				callback.call(this,t,tiddler);
		}
	};
}

TiddlyWiki.prototype.setDirty = function(dirty)
{
	this.dirty = dirty;
};

TiddlyWiki.prototype.isDirty = function()
{
	return this.dirty;
};

TiddlyWiki.prototype.tiddlerExists = function(title)
{
	var t = this.fetchTiddler(title);
	return t != undefined;
};

TiddlyWiki.prototype.isShadowTiddler = function(title)
{
	return config.shadowTiddlers[title] === undefined ? false : true;
};

TiddlyWiki.prototype.createTiddler = function(title)
{
	var tiddler = this.fetchTiddler(title);
	if(!tiddler) {
		tiddler = new Tiddler(title);
		this.addTiddler(tiddler);
		this.setDirty(true);
	}
	return tiddler;
};

TiddlyWiki.prototype.getTiddler = function(title)
{
	var t = this.fetchTiddler(title);
	if(t != undefined)
		return t;
	else
		return null;
};

TiddlyWiki.prototype.getShadowTiddlerText = function(title)
{
	if(typeof config.shadowTiddlers[title] == "string")
		return config.shadowTiddlers[title];
	else
		return "";
};

// Retrieve tiddler contents
TiddlyWiki.prototype.getTiddlerText = function(title,defaultText)
{
	if(!title)
		return defaultText;
	var pos = title.indexOf(config.textPrimitives.sectionSeparator);
	var section = null;
	if(pos != -1) {
		section = title.substr(pos + config.textPrimitives.sectionSeparator.length);
		title = title.substr(0,pos);
	}
	pos = title.indexOf(config.textPrimitives.sliceSeparator);
	if(pos != -1) {
		var slice = this.getTiddlerSlice(title.substr(0,pos),title.substr(pos + config.textPrimitives.sliceSeparator.length));
		if(slice)
			return slice;
	}
	var tiddler = this.fetchTiddler(title);
	var text = tiddler ? tiddler.text : null;
	if(!tiddler && this.isShadowTiddler(title)) {
		text = this.getShadowTiddlerText(title);
	}
	if(text) {
		if(!section)
			return text;
		var re = new RegExp("(^!{1,6}[ \t]*" + section.escapeRegExp() + "[ \t]*\n)","mg");
		re.lastIndex = 0;
		var match = re.exec(text);
		if(match) {
			var t = text.substr(match.index+match[1].length);
			var re2 = /^!/mg;
			re2.lastIndex = 0;
			match = re2.exec(t); //# search for the next heading
			if(match)
				t = t.substr(0,match.index-1);//# don't include final \n
			return t;
		}
		return defaultText;
	}
	if(defaultText != undefined)
		return defaultText;
	return null;
};

TiddlyWiki.prototype.getRecursiveTiddlerText = function(title,defaultText,depth)
{
	var bracketRegExp = new RegExp("(?:\\[\\[([^\\]]+)\\]\\])","mg");
	var text = this.getTiddlerText(title,null);
	if(text == null)
		return defaultText;
	var textOut = [];
	var lastPos = 0;
	do {
		var match = bracketRegExp.exec(text);
		if(match) {
			textOut.push(text.substr(lastPos,match.index-lastPos));
			if(match[1]) {
				if(depth <= 0)
					textOut.push(match[1]);
				else
					textOut.push(this.getRecursiveTiddlerText(match[1],"",depth-1));
			}
			lastPos = match.index + match[0].length;
		} else {
			textOut.push(text.substr(lastPos));
		}
	} while(match);
	return textOut.join("");
};

//TiddlyWiki.prototype.slicesRE = /(?:^([\'\/]{0,2})~?([\.\w]+)\:\1[\t\x20]*([^\n]+)[\t\x20]*$)|(?:^\|([\'\/]{0,2})~?([\.\w]+)\:?\4\|[\t\x20]*([^\n]+)[\t\x20]*\|$)/gm;
TiddlyWiki.prototype.slicesRE = /(?:^([\'\/]{0,2})~?([\.\w]+)\:\1[\t\x20]*([^\n]*)[\t\x20]*$)|(?:^\|([\'\/]{0,2})~?([\.\w]+)\:?\4\|[\t\x20]*([^\|\n]*)[\t\x20]*\|$)/gm;
// @internal
TiddlyWiki.prototype.calcAllSlices = function(title)
{
	var slices = {};
	var text = this.getTiddlerText(title,"");
	this.slicesRE.lastIndex = 0;
	var m = this.slicesRE.exec(text);
	while(m) {
		if(m[2])
			slices[m[2]] = m[3];
		else
			slices[m[5]] = m[6];
		m = this.slicesRE.exec(text);
	}
	return slices;
};

// Returns the slice of text of the given name
TiddlyWiki.prototype.getTiddlerSlice = function(title,sliceName)
{
	var slices = this.slices[title];
	if(!slices) {
		slices = this.calcAllSlices(title);
		this.slices[title] = slices;
	}
	return slices[sliceName];
};

// Build an hashmap of the specified named slices of a tiddler
TiddlyWiki.prototype.getTiddlerSlices = function(title,sliceNames)
{
	var r = {};
	for(var t=0; t<sliceNames.length; t++) {
		var slice = this.getTiddlerSlice(title,sliceNames[t]);
		if(slice)
			r[sliceNames[t]] = slice;
	}
	return r;
};

TiddlyWiki.prototype.suspendNotifications = function()
{
	this.notificationLevel--;
};

TiddlyWiki.prototype.resumeNotifications = function()
{
	this.notificationLevel++;
};

// Invoke the notification handlers for a particular tiddler
TiddlyWiki.prototype.notify = function(title,doBlanket)
{
	if(!this.notificationLevel) {
		for(var t=0; t<this.namedNotifications.length; t++) {
			var n = this.namedNotifications[t];
			if((n.name == null && doBlanket) || (n.name == title))
				n.notify(title);
		}
	}
};

// Invoke the notification handlers for all tiddlers
TiddlyWiki.prototype.notifyAll = function()
{
	if(!this.notificationLevel) {
		for(var t=0; t<this.namedNotifications.length; t++) {
			var n = this.namedNotifications[t];
			if(n.name)
				n.notify(n.name);
		}
	}
};

// Add a notification handler to a tiddler
TiddlyWiki.prototype.addNotification = function(title,fn)
{
	for(var i=0; i<this.namedNotifications.length; i++) {
		if((this.namedNotifications[i].name == title) && (this.namedNotifications[i].notify == fn))
			return this;
	}
	this.namedNotifications.push({name: title, notify: fn});
	return this;
};

TiddlyWiki.prototype.removeTiddler = function(title)
{
	var tiddler = this.fetchTiddler(title);
	if(tiddler) {
		this.deleteTiddler(title);
		this.notify(title,true);
		this.setDirty(true);
	}
};

// Reset the sync status of a freshly synced tiddler
TiddlyWiki.prototype.resetTiddler = function(title)
{
	var tiddler = this.fetchTiddler(title);
	if(tiddler) {
		tiddler.clearChangeCount();
		this.notify(title,true);
		this.setDirty(true);
	}
};

TiddlyWiki.prototype.setTiddlerTag = function(title,status,tag)
{
	var tiddler = this.fetchTiddler(title);
	if(tiddler) {
		var t = tiddler.tags.indexOf(tag);
		if(t != -1)
			tiddler.tags.splice(t,1);
		if(status)
			tiddler.tags.push(tag);
		tiddler.changed();
		tiddler.incChangeCount();
		this.notify(title,true);
		this.setDirty(true);
	}
};

TiddlyWiki.prototype.addTiddlerFields = function(title,fields)
{
	var tiddler = this.fetchTiddler(title);
	if(!tiddler)
		return;
	merge(tiddler.fields,fields);
	tiddler.changed();
	tiddler.incChangeCount();
	this.notify(title,true);
	this.setDirty(true);
};

// Store tiddler in TiddlyWiki instance
TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created,creator)
{
	var tiddler;
	if(title instanceof Tiddler) {
		tiddler = title;
		title = tiddler.title;
		newTitle = title;
	} else {
		tiddler = this.fetchTiddler(title);
		if(tiddler) {
			created = created || tiddler.created; // Preserve created date
			creator = creator || tiddler.creator;
			this.deleteTiddler(title);
		} else {
			created = created || modified;
			tiddler = new Tiddler();
		}
		fields = merge({},fields);
		tiddler.set(newTitle,newBody,modifier,modified,tags,created,fields,creator);
	}
	this.addTiddler(tiddler);
	if(clearChangeCount)
		tiddler.clearChangeCount();
	else
		tiddler.incChangeCount();
	if(title != newTitle)
		this.notify(title,true);
	this.notify(newTitle,true);
	this.setDirty(true);
	return tiddler;
};

TiddlyWiki.prototype.incChangeCount = function(title)
{
	var tiddler = this.fetchTiddler(title);
	if(tiddler)
		tiddler.incChangeCount();
};

TiddlyWiki.prototype.getLoader = function()
{
	if(!this.loader)
		this.loader = new TW21Loader();
	return this.loader;
};

TiddlyWiki.prototype.getSaver = function()
{
	if(!this.saver)
		this.saver = new TW21Saver();
	return this.saver;
};

// Return all tiddlers formatted as an HTML string
TiddlyWiki.prototype.allTiddlersAsHtml = function()
{
	return this.getSaver().externalize(store);
};

// Load contents of a TiddlyWiki from an HTML DIV
TiddlyWiki.prototype.loadFromDiv = function(src,idPrefix,noUpdate)
{
	this.idPrefix = idPrefix;
	var storeElem = (typeof src == "string") ? document.getElementById(src) : src;
	if(!storeElem)
		return;
	var tiddlers = this.getLoader().loadTiddlers(this,storeElem.childNodes);
	this.setDirty(false);
	if(!noUpdate) {
		for(var i = 0;i<tiddlers.length; i++)
			tiddlers[i].changed();
	}
	jQuery(document).trigger("loadTiddlers");
};

// Load contents of a TiddlyWiki from a string
// Returns null if there's an error
TiddlyWiki.prototype.importTiddlyWiki = function(text)
{
	var posDiv = locateStoreArea(text);
	if(!posDiv)
		return null;
	var content = "<" + "html><" + "body>" + text.substring(posDiv[0],posDiv[1] + endSaveArea.length) + "<" + "/body><" + "/html>";
	// Create the iframe
	var iframe = document.createElement("iframe");
	iframe.style.display = "none";
	document.body.appendChild(iframe);
	var doc = iframe.document;
	if(iframe.contentDocument)
		doc = iframe.contentDocument; // For NS6
	else if(iframe.contentWindow)
		doc = iframe.contentWindow.document; // For IE5.5 and IE6
	// Put the content in the iframe
	doc.open();
	doc.writeln(content);
	doc.close();
	// Load the content into a TiddlyWiki() object
	var storeArea = doc.getElementById("storeArea");
	this.loadFromDiv(storeArea,"store");
	// Get rid of the iframe
	iframe.parentNode.removeChild(iframe);
	return this;
};

TiddlyWiki.prototype.updateTiddlers = function()
{
	this.tiddlersUpdated = true;
	this.forEachTiddler(function(title,tiddler) {
		tiddler.changed();
	});
};

// Return an array of tiddlers matching a search regular expression
TiddlyWiki.prototype.search = function(searchRegExp,sortField,excludeTag,match)
{
	var candidates = this.reverseLookup("tags",excludeTag,!!match);
	var results = [];
	for(var t=0; t<candidates.length; t++) {
		if((candidates[t].title.search(searchRegExp) != -1) || (candidates[t].text.search(searchRegExp) != -1))
			results.push(candidates[t]);
	}
	if(!sortField)
		sortField = "title";
	results.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);});
	return results;
};

// Returns a list of all tags in use
//   excludeTag - if present, excludes tags that are themselves tagged with excludeTag
// Returns an array of arrays where [tag][0] is the name of the tag and [tag][1] is the number of occurances
TiddlyWiki.prototype.getTags = function(excludeTag)
{
	var results = [];
	this.forEachTiddler(function(title,tiddler) {
		for(var g=0; g<tiddler.tags.length; g++) {
			var tag = tiddler.tags[g];
			var n = true;
			for(var c=0; c<results.length; c++) {
				if(results[c][0] == tag) {
					n = false;
					results[c][1]++;
				}
			}
			if(n && excludeTag) {
				var t = this.fetchTiddler(tag);
				if(t && t.isTagged(excludeTag))
					n = false;
			}
			if(n)
				results.push([tag,1]);
		}
	});
	results.sort(function(a,b) {return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : (a[0].toLowerCase() == b[0].toLowerCase() ? 0 : +1);});
	return results;
};

// Return an array of the tiddlers that are tagged with a given tag
TiddlyWiki.prototype.getTaggedTiddlers = function(tag,sortField)
{
	return this.reverseLookup("tags",tag,true,sortField);
};

TiddlyWiki.prototype.getValueTiddlers = function(field,value,sortField)
{
	return this.reverseLookup(field,value,true,sortField);
};

// Return an array of the tiddlers that link to a given tiddler
TiddlyWiki.prototype.getReferringTiddlers = function(title,unusedParameter,sortField)
{
	if(!this.tiddlersUpdated)
		this.updateTiddlers();
	return this.reverseLookup("links",title,true,sortField);
};

// Return an array of the tiddlers that do or do not have a specified entry in the specified storage array (ie, "links" or "tags")
// lookupMatch == true to match tiddlers, false to exclude tiddlers
TiddlyWiki.prototype.reverseLookup = function(lookupField,lookupValue,lookupMatch,sortField)
{
	var results = [];
	this.forEachTiddler(function(title,tiddler) {
		var f = !lookupMatch;
		var values;
		if(["links", "tags"].contains(lookupField)) {
			values = tiddler[lookupField];
		} else {
			values = tiddler.fields[lookupField] ? [tiddler.fields[lookupField]] : [];
		}
		for(var lookup=0; lookup<values.length; lookup++) {
			if(values[lookup] == lookupValue)
				f = lookupMatch;
		}
		if(f)
			results.push(tiddler);
	});
	if(!sortField)
		sortField = "title";
	return this.sortTiddlers(results,sortField);
};

// Return the tiddlers as a sorted array
TiddlyWiki.prototype.getTiddlers = function(field,excludeTag)
{
	var results = [];
	this.forEachTiddler(function(title,tiddler) {
		if(excludeTag == undefined || !tiddler.isTagged(excludeTag))
			results.push(tiddler);
	});
	if(field)
		results.sort(function(a,b) {return a[field] < b[field] ? -1 : (a[field] == b[field] ? 0 : +1);});
	return results;
};

// Return array of names of tiddlers that are referred to but not defined
TiddlyWiki.prototype.getMissingLinks = function(sortField)
{
	if(!this.tiddlersUpdated)
		this.updateTiddlers();
	var results = [];
	this.forEachTiddler(function (title,tiddler) {
		if(tiddler.isTagged("excludeMissing") || tiddler.isTagged("systemConfig"))
			return;
		for(var n=0; n<tiddler.links.length;n++) {
			var link = tiddler.links[n];
			if(this.getTiddlerText(link,null) == null && !this.isShadowTiddler(link) && !config.macros[link])
				results.pushUnique(link);
		}
	});
	results.sort();
	return results;
};

// Return an array of names of tiddlers that are defined but not referred to
TiddlyWiki.prototype.getOrphans = function()
{
	var results = [];
	this.forEachTiddler(function (title,tiddler) {
		if(this.getReferringTiddlers(title).length == 0 && !tiddler.isTagged("excludeLists"))
			results.push(title);
	});
	results.sort();
	return results;
};

// Return an array of names of all the shadow tiddlers
TiddlyWiki.prototype.getShadowed = function()
{
	var results = [];
	for(var t in config.shadowTiddlers) {
		if(this.isShadowTiddler(t))
			results.push(t);
	}
	results.sort();
	return results;
};

// Return an array of tiddlers that have been touched since they were downloaded or created
TiddlyWiki.prototype.getTouched = function()
{
	var results = [];
	this.forEachTiddler(function(title,tiddler) {
		if(tiddler.isTouched())
			results.push(tiddler);
		});
	results.sort();
	return results;
};

// Resolves a Tiddler reference or tiddler title into a Tiddler object, or null if it doesn't exist
TiddlyWiki.prototype.resolveTiddler = function(tiddler)
{
	var t = (typeof tiddler == "string") ? this.getTiddler(tiddler) : tiddler;
	return t instanceof Tiddler ? t : null;
};

// Sort a list of tiddlers
TiddlyWiki.prototype.sortTiddlers = function(tiddlers,field)
{
	var asc = +1;
	switch(field.substr(0,1)) {
	case "-":
		asc = -1;
		// Note: this fall-through is intentional
		/*jsl:fallthru*/
	case "+":
		field = field.substr(1);
		break;
	}
	if(TiddlyWiki.standardFieldAccess[field]) {
		if(field=="title") {
			tiddlers.sort(function(a,b) {return a[field].toLowerCase() < b[field].toLowerCase() ? -asc : (a[field].toLowerCase() == b[field].toLowerCase() ? 0 : asc);});
		} else {
			tiddlers.sort(function(a,b) {return a[field] < b[field] ? -asc : (a[field] == b[field] ? 0 : asc);});
		}
	} else {
		tiddlers.sort(function(a,b) {return a.fields[field] < b.fields[field] ? -asc : (a.fields[field] == b.fields[field] ? 0 : +asc);});
	}
	return tiddlers;
};

//--
//-- Filter a list of tiddlers
//--

config.filters = {
	tiddler: function(results,match) {
		var title = match[1]||match[4];
		var tiddler = this.fetchTiddler(title);
		if(tiddler) {
			results.pushUnique(tiddler);
		} else if(this.isShadowTiddler(title)) {
			tiddler = new Tiddler();
			tiddler.set(title,this.getTiddlerText(title));
			results.pushUnique(tiddler);
		} else {
			results.pushUnique(new Tiddler(title));
		}
		return results;
	},
	tag: function(results,match) {
		var matched = this.getTaggedTiddlers(match[3]);
		for(var m=0; m<matched.length; m++) {
			results.pushUnique(matched[m]);
		}
		return results;
	},
	sort: function(results,match) {
		return this.sortTiddlers(results,match[3]);
	},
	limit: function(results,match) {
		return results.slice(0,parseInt(match[3],10));
	},
	field: function(results,match) {
		var matched = this.getValueTiddlers(match[2],match[3]);
		for (var m = 0; m < matched.length; m++) {
			results.pushUnique(matched[m]);
		}
		return results;
	}
};

// Filter a list of tiddlers
TiddlyWiki.prototype.filterTiddlers = function(filter)
{
	var re = /([^\s\[\]]+)|(?:\[([ \w\.\-]+)\[([^\]]+)\]\])|(?:\[\[([^\]]+)\]\])/mg;

	var results = [];
	if(filter) {
		var match = re.exec(filter);
		while(match) {
			var handler = (match[1]||match[4])?'tiddler':config.filters[match[2]]?match[2]:'field';
			results = config.filters[handler].call(this,results,match);
			match = re.exec(filter);
		}
	}
	return results;
};
// Returns true if path is a valid field name (path),
// i.e. a sequence of identifiers, separated by "."
TiddlyWiki.isValidFieldName = function(name)
{
	var match = /[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*/.exec(name);
	return match && (match[0] == name);
};

// Throws an exception when name is not a valid field name.
TiddlyWiki.checkFieldName = function(name)
{
	if(!TiddlyWiki.isValidFieldName(name))
		throw config.messages.invalidFieldName.format([name]);
};

function StringFieldAccess(n,readOnly)
{
	this.set = readOnly ?
			function(t,v) {if(v != t[n]) throw config.messages.fieldCannotBeChanged.format([n]);} :
			function(t,v) {if(v != t[n]) {t[n] = v; return true;}};
	this.get = function(t) {return t[n];};
}

function DateFieldAccess(n)
{
	this.set = function(t,v) {
		var d = v instanceof Date ? v : Date.convertFromYYYYMMDDHHMM(v);
		if(d != t[n]) {
			t[n] = d; return true;
		}
	};
	this.get = function(t) {return t[n].convertToYYYYMMDDHHMM();};
}

function LinksFieldAccess(n)
{
	this.set = function(t,v) {
		var s = (typeof v == "string") ? v.readBracketedList() : v;
		if(s.toString() != t[n].toString()) {
			t[n] = s; return true;
		}
	};
	this.get = function(t) {return String.encodeTiddlyLinkList(t[n]);};
}

TiddlyWiki.standardFieldAccess = {
	// The set functions return true when setting the data has changed the value.
	"title":    new StringFieldAccess("title",true),
	// Handle the "tiddler" field name as the title
	"tiddler":  new StringFieldAccess("title",true),
	"text":     new StringFieldAccess("text"),
	"modifier": new StringFieldAccess("modifier"),
	"modified": new DateFieldAccess("modified"),
	"creator":  new StringFieldAccess("creator"),
	"created":  new DateFieldAccess("created"),
	"tags":     new LinksFieldAccess("tags")
};

TiddlyWiki.isStandardField = function(name)
{
	return TiddlyWiki.standardFieldAccess[name] != undefined;
};

// Sets the value of the given field of the tiddler to the value.
// Setting an ExtendedField's value to null or undefined removes the field.
// Setting a namespace to undefined removes all fields of that namespace.
// The fieldName is case-insensitive.
// All values will be converted to a string value.
TiddlyWiki.prototype.setValue = function(tiddler,fieldName,value)
{
	TiddlyWiki.checkFieldName(fieldName);
	var t = this.resolveTiddler(tiddler);
	if(!t)
		return;
	fieldName = fieldName.toLowerCase();
	var isRemove = (value === undefined) || (value === null);
	var accessor = TiddlyWiki.standardFieldAccess[fieldName];
	if(accessor) {
		if(isRemove)
			// don't remove StandardFields
			return;
		var h = TiddlyWiki.standardFieldAccess[fieldName];
		if(!h.set(t,value))
			return;
	} else {
		var oldValue = t.fields[fieldName];
		if(isRemove) {
			if(oldValue !== undefined) {
				// deletes a single field
				delete t.fields[fieldName];
			} else {
				// no concrete value is defined for the fieldName
				// so we guess this is a namespace path.
				// delete all fields in a namespace
				var re = new RegExp("^"+fieldName+"\\.");
				var dirty = false;
				for(var n in t.fields) {
					if(n.match(re)) {
						delete t.fields[n];
						dirty = true;
					}
				}
				if(!dirty)
					return;
			}
		} else {
			// the "normal" set case. value is defined (not null/undefined)
			// For convenience provide a nicer conversion Date->String
			value = value instanceof Date ? value.convertToYYYYMMDDHHMMSSMMM() : String(value);
			if(oldValue == value)
				return;
			t.fields[fieldName] = value;
		}
	}
	// When we are here the tiddler/store really was changed.
	this.notify(t.title,true);
	if(!fieldName.match(/^temp\./))
		this.setDirty(true);
};

// Returns the value of the given field of the tiddler.
// The fieldName is case-insensitive.
// Will only return String values (or undefined).
TiddlyWiki.prototype.getValue = function(tiddler,fieldName)
{
	var t = this.resolveTiddler(tiddler);
	if(!t)
		return undefined;
	fieldName = fieldName.toLowerCase();
	var accessor = TiddlyWiki.standardFieldAccess[fieldName];
	if(accessor) {
		return accessor.get(t);
	}
	return t.fields[fieldName];
};

// Calls the callback function for every field in the tiddler.
// When callback function returns a non-false value the iteration stops
// and that value is returned.
// The order of the fields is not defined.
// @param callback a function(tiddler,fieldName,value).
TiddlyWiki.prototype.forEachField = function(tiddler,callback,onlyExtendedFields)
{
	var t = this.resolveTiddler(tiddler);
	if(!t)
		return undefined;
	var n,result;
	for(n in t.fields) {
		result = callback(t,n,t.fields[n]);
		if(result)
			return result;
		}
	if(onlyExtendedFields)
		return undefined;
	for(n in TiddlyWiki.standardFieldAccess) {
		if(n == "tiddler")
			// even though the "title" field can also be referenced through the name "tiddler"
			// we only visit this field once.
			continue;
		result = callback(t,n,TiddlyWiki.standardFieldAccess[n].get(t));
		if(result)
			return result;
	}
	return undefined;
};

//--
//-- Story functions
//--

function Story(containerId,idPrefix)
{
	this.container = containerId;
	this.idPrefix = idPrefix;
	this.highlightRegExp = null;
	this.tiddlerId = function(title) {
		var id = this.idPrefix + title;
		return id==this.container ? this.idPrefix + "_" + title : id;
	};
	this.containerId = function() {
		return this.container;
	};
}

Story.prototype.getTiddler = function(title)
{
	return document.getElementById(this.tiddlerId(title));
};

Story.prototype.getContainer = function()
{
	return document.getElementById(this.containerId());
};

Story.prototype.forEachTiddler = function(fn)
{
	var place = this.getContainer();
	if(!place)
		return;
	var e = place.firstChild;
	while(e) {
		var n = e.nextSibling;
		var title = e.getAttribute("tiddler");
		fn.call(this,title,e);
		e = n;
	}
};

Story.prototype.displayDefaultTiddlers = function()
{
	this.displayTiddlers(null,store.filterTiddlers(store.getTiddlerText("DefaultTiddlers")));
};

Story.prototype.displayTiddlers = function(srcElement,titles,template,animate,unused,customFields,toggle)
{
	for(var t = titles.length-1;t>=0;t--)
		this.displayTiddler(srcElement,titles[t],template,animate,unused,customFields);
};

Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle,animationSrc)
{
	var title = (tiddler instanceof Tiddler) ? tiddler.title : tiddler;
	var tiddlerElem = this.getTiddler(title);
	if(tiddlerElem) {
		if(toggle) {
			if(tiddlerElem.getAttribute("dirty") != "true")
				this.closeTiddler(title,true);
		} else {
			this.refreshTiddler(title,template,false,customFields);
		}
	} else {
		var place = this.getContainer();
		var before = this.positionTiddler(srcElement);
		tiddlerElem = this.createTiddler(place,before,title,template,customFields);
	}
	if(animationSrc && typeof animationSrc !== "string") {
		srcElement = animationSrc;
	}
	if(srcElement && typeof srcElement !== "string") {
		if(config.options.chkAnimate && (animate == undefined || animate == true) && anim && typeof Zoomer == "function" && typeof Scroller == "function")
			anim.startAnimating(new Zoomer(title,srcElement,tiddlerElem),new Scroller(tiddlerElem));
		else
			window.scrollTo(0,ensureVisible(tiddlerElem));
	}
	return tiddlerElem;
};

Story.prototype.positionTiddler = function(srcElement)
{
	var place = this.getContainer();
	var before = null;
	if(typeof srcElement == "string") {
		switch(srcElement) {
		case "top":
			before = place.firstChild;
			break;
		case "bottom":
			before = null;
			break;
		}
	} else {
		var after = this.findContainingTiddler(srcElement);
		if(after == null) {
			before = place.firstChild;
		} else if(after.nextSibling) {
			before = after.nextSibling;
			if(before.nodeType != 1)
				before = null;
		}
	}
	return before;
};

Story.prototype.createTiddler = function(place,before,title,template,customFields)
{
	var tiddlerElem = createTiddlyElement(null,"div",this.tiddlerId(title),"tiddler");
	tiddlerElem.setAttribute("refresh","tiddler");
	if(customFields)
		tiddlerElem.setAttribute("tiddlyFields",customFields);
	place.insertBefore(tiddlerElem,before);
	var defaultText = null;
	if(!store.tiddlerExists(title) && !store.isShadowTiddler(title))
		defaultText = this.loadMissingTiddler(title,customFields);
	this.refreshTiddler(title,template,false,customFields,defaultText);
	return tiddlerElem;
};

Story.prototype.loadMissingTiddler = function(title,fields,callback)
{
	var getTiddlerCallback = function(context)
	{
		if(context.status) {
			var t = context.tiddler;
			if(!t.created)
				t.created = new Date();
			if(!t.modified)
				t.modified = t.created;
			context.tiddler = store.saveTiddler(t.title,t.title,t.text,t.modifier,t.modified,t.tags,t.fields,true,t.created,t.creator);
			autoSaveChanges();
		} else {
			story.refreshTiddler(context.title,null,true);
		}
		context.adaptor.close();
		if(callback) {
			callback(context);
		}
	};
	var tiddler = new Tiddler(title);
	tiddler.fields = typeof fields == "string" ? fields.decodeHashMap() : fields||{};
	var context = {serverType:tiddler.getServerType()};
	if(!context.serverType)
		return;
	context.host = tiddler.fields['server.host'];
	context.workspace = tiddler.fields['server.workspace'];
	var adaptor = new config.adaptors[context.serverType];
	adaptor.getTiddler(title,context,null,getTiddlerCallback);
	return config.messages.loadingMissingTiddler.format([title,context.serverType,context.host,context.workspace]);
};

Story.prototype.chooseTemplateForTiddler = function(title,template)
{
	if(!template)
		template = DEFAULT_VIEW_TEMPLATE;
	if(template == DEFAULT_VIEW_TEMPLATE || template == DEFAULT_EDIT_TEMPLATE)
		template = config.tiddlerTemplates[template];
	return template;
};

Story.prototype.getTemplateForTiddler = function(title,template,tiddler)
{
	return store.getRecursiveTiddlerText(template,null,10);
};

Story.prototype.refreshTiddler = function(title,template,force,customFields,defaultText)
{
	var tiddlerElem = this.getTiddler(title);
	if(tiddlerElem) {
		if(tiddlerElem.getAttribute("dirty") == "true" && !force)
			return tiddlerElem;
		template = this.chooseTemplateForTiddler(title,template);
		var currTemplate = tiddlerElem.getAttribute("template");
		if((template != currTemplate) || force) {
			var tiddler = store.getTiddler(title);
			if(!tiddler) {
				tiddler = new Tiddler();
				if(store.isShadowTiddler(title)) {
					var tags = [];
					tiddler.set(title,store.getTiddlerText(title),config.views.wikified.shadowModifier,version.date,tags,version.date);
				} else {
					var text = template=="EditTemplate" ?
								config.views.editor.defaultText.format([title]) :
								config.views.wikified.defaultText.format([title]);
					text = defaultText || text;
					var fields = customFields ? customFields.decodeHashMap() : null;
					tiddler.set(title,text,config.views.wikified.defaultModifier,version.date,[],version.date,fields);
				}
			}
			tiddlerElem.setAttribute("tags",tiddler.tags.join(" "));
			tiddlerElem.setAttribute("tiddler",title);
			tiddlerElem.setAttribute("template",template);
			tiddlerElem.onmouseover = this.onTiddlerMouseOver;
			tiddlerElem.onmouseout = this.onTiddlerMouseOut;
			tiddlerElem.ondblclick = this.onTiddlerDblClick;
			tiddlerElem[window.event?"onkeydown":"onkeypress"] = this.onTiddlerKeyPress;
			tiddlerElem.innerHTML = this.getTemplateForTiddler(title,template,tiddler);
			applyHtmlMacros(tiddlerElem,tiddler);
			if(store.getTaggedTiddlers(title).length > 0)
				addClass(tiddlerElem,"isTag");
			else
				removeClass(tiddlerElem,"isTag");
			if(store.tiddlerExists(title)) {
				removeClass(tiddlerElem,"shadow");
				removeClass(tiddlerElem,"missing");
			} else {
				addClass(tiddlerElem, store.isShadowTiddler(title) ? "shadow" : "missing");
			}
			if(customFields)
				this.addCustomFields(tiddlerElem,customFields);
			forceReflow();
		}
	}
	return tiddlerElem;
};

Story.prototype.addCustomFields = function(place,customFields)
{
	var fields = customFields.decodeHashMap();
	var w = createTiddlyElement(place,"div",null,"customFields");
	w.style.display = "none";
	for(var t in fields) {
		var e = document.createElement("input");
		e.setAttribute("type","text");
		e.setAttribute("value",fields[t]);
		w.appendChild(e);
		e.setAttribute("edit",t);
	}
};

Story.prototype.refreshAllTiddlers = function(force)
{
	var e = this.getContainer().firstChild;
	while(e) {
		var template = e.getAttribute("template");
		if(template && e.getAttribute("dirty") != "true") {
			this.refreshTiddler(e.getAttribute("tiddler"),force ? null : template,true);
		}
		e = e.nextSibling;
	}
};

Story.prototype.onTiddlerMouseOver = function(e)
{
	addClass(this, "selected");
};

Story.prototype.onTiddlerMouseOut = function(e)
{
	removeClass(this,"selected");
};

Story.prototype.onTiddlerDblClick = function(ev)
{
	var e = ev || window.event;
	var target = resolveTarget(e);
	if(target && target.nodeName.toLowerCase() != "input" && target.nodeName.toLowerCase() != "textarea") {
		if(document.selection && document.selection.empty)
			document.selection.empty();
		config.macros.toolbar.invokeCommand(this,"defaultCommand",e);
		e.cancelBubble = true;
		if(e.stopPropagation) e.stopPropagation();
		return true;
	}
	return false;
};

Story.prototype.onTiddlerKeyPress = function(ev)
{
	var e = ev || window.event;
	clearMessage();
	var consume = false;
	var title = this.getAttribute("tiddler");
	var target = resolveTarget(e);
	switch(e.keyCode) {
	case 9: // Tab
		var ed = story.getTiddlerField(title,"text");
		if(target.tagName.toLowerCase() == "input" && ed.value==config.views.editor.defaultText.format([title])) {
			// moving from input field and editor still contains default text, so select it
			ed.focus();
			ed.select();
			consume = true;
		}
		if(config.options.chkInsertTabs && target.tagName.toLowerCase() == "textarea") {
			replaceSelection(target,String.fromCharCode(9));
			consume = true;
		}
		if(config.isOpera) {
			target.onblur = function() {
				this.focus();
				this.onblur = null;
			};
		}
		break;
	case 13: // Ctrl-Enter
	case 10: // Ctrl-Enter on IE PC
	case 77: // Ctrl-Enter is "M" on some platforms
		if(e.ctrlKey) {
			blurElement(this);
			config.macros.toolbar.invokeCommand(this,"defaultCommand",e);
			consume = true;
		}
		break;
	case 27: // Escape
		blurElement(this);
		config.macros.toolbar.invokeCommand(this,"cancelCommand",e);
		consume = true;
		break;
	}
	e.cancelBubble = consume;
	if(consume) {
		if(e.stopPropagation) e.stopPropagation(); // Stop Propagation
		e.returnValue = true; // Cancel The Event in IE
		if(e.preventDefault ) e.preventDefault(); // Cancel The Event in Moz
	}
	return !consume;
};

Story.prototype.getTiddlerField = function(title,field)
{
	var tiddlerElem = this.getTiddler(title);
	var e = null;
	if(tiddlerElem) {
		var children = tiddlerElem.getElementsByTagName("*");
		for(var t=0; t<children.length; t++) {
			var c = children[t];
			if(c.tagName.toLowerCase() == "input" || c.tagName.toLowerCase() == "textarea") {
				if(!e)
					e = c;
				if(c.getAttribute("edit") == field)
					e = c;
			}
		}
	}
	return e;
};

Story.prototype.focusTiddler = function(title,field)
{
	var e = this.getTiddlerField(title,field);
	if(e) {
		e.focus();
		e.select();
	}
};

Story.prototype.blurTiddler = function(title)
{
	var tiddlerElem = this.getTiddler(title);
	if(tiddlerElem && tiddlerElem.focus && tiddlerElem.blur) {
		tiddlerElem.focus();
		tiddlerElem.blur();
	}
};

Story.prototype.setTiddlerField = function(title,tag,mode,field)
{
	var c = this.getTiddlerField(title,field);
	var tags = c.value.readBracketedList();
	tags.setItem(tag,mode);
	c.value = String.encodeTiddlyLinkList(tags);
};

Story.prototype.setTiddlerTag = function(title,tag,mode)
{
	this.setTiddlerField(title,tag,mode,"tags");
};

Story.prototype.closeTiddler = function(title,animate,unused)
{
	var tiddlerElem = this.getTiddler(title);
	if(tiddlerElem) {
		clearMessage();
		this.scrubTiddler(tiddlerElem);
		if(config.options.chkAnimate && animate && anim && typeof Slider == "function")
			anim.startAnimating(new Slider(tiddlerElem,false,null,"all"));
		else {
			removeNode(tiddlerElem);
			forceReflow();
		}
	}
};

Story.prototype.scrubTiddler = function(tiddlerElem)
{
	tiddlerElem.id = null;
};

Story.prototype.setDirty = function(title,dirty)
{
	var tiddlerElem = this.getTiddler(title);
	if(tiddlerElem)
		tiddlerElem.setAttribute("dirty",dirty ? "true" : "false");
};

Story.prototype.isDirty = function(title)
{
	var tiddlerElem = this.getTiddler(title);
	if(tiddlerElem)
		return tiddlerElem.getAttribute("dirty") == "true";
	return null;
};

Story.prototype.areAnyDirty = function()
{
	var r = false;
	this.forEachTiddler(function(title,element) {
		if(this.isDirty(title))
			r = true;
	});
	return r;
};

Story.prototype.closeAllTiddlers = function(exclude)
{
	clearMessage();
	this.forEachTiddler(function(title,element) {
		if((title != exclude) && element.getAttribute("dirty") != "true")
			this.closeTiddler(title);
	});
	window.scrollTo(0,ensureVisible(this.container));
};

Story.prototype.isEmpty = function()
{
	var place = this.getContainer();
	return place && place.firstChild == null;
};

Story.prototype.search = function(text,useCaseSensitive,useRegExp)
{
	this.closeAllTiddlers();
	highlightHack = new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img");
	var matches = store.search(highlightHack,"title","excludeSearch");
	this.displayTiddlers(null,matches);
	highlightHack = null;
	var q = useRegExp ? "/" : "'";
	if(matches.length > 0)
		displayMessage(config.macros.search.successMsg.format([matches.length.toString(),q + text + q]));
	else
		displayMessage(config.macros.search.failureMsg.format([q + text + q]));
};

Story.prototype.findContainingTiddler = function(e)
{
	while(e && !hasClass(e,"tiddler")) {
		e = hasClass(e,"popup") && Popup.stack[0] ? Popup.stack[0].root : e.parentNode;
	}
	return e;
};

Story.prototype.gatherSaveFields = function(e,fields)
{
	if(e && e.getAttribute) {
		var f = e.getAttribute("edit");
		if(f)
			fields[f] = e.value.replace(/\r/mg,"");
		if(e.hasChildNodes()) {
			var c = e.childNodes;
			for(var t=0; t<c.length; t++)
				this.gatherSaveFields(c[t],fields);
		}
	}
};

Story.prototype.hasChanges = function(title)
{
	var e = this.getTiddler(title);
	if(e) {
		var fields = {};
		this.gatherSaveFields(e,fields);
		if(store.fetchTiddler(title)) {
			for(var n in fields) {
				if(store.getValue(title,n) != fields[n]) //# tiddler changed
					return true;
			}
		} else {
			if(store.isShadowTiddler(title) && store.getShadowTiddlerText(title) == fields.text) { //# not checking for title or tags
				return false;
			} else { //# changed shadow or new tiddler
				return true;
			}
		}
	}
	return false;
};

Story.prototype.saveTiddler = function(title,minorUpdate)
{
	var tiddlerElem = this.getTiddler(title);
	if(tiddlerElem) {
		var fields = {};
		this.gatherSaveFields(tiddlerElem,fields);
		var newTitle = fields.title || title;
		if(!store.tiddlerExists(newTitle)) {
			newTitle = newTitle.trim();
			var creator = config.options.txtUserName;
		}
		if(store.tiddlerExists(newTitle) && newTitle != title) {
			if(!confirm(config.messages.overwriteWarning.format([newTitle.toString()])))
				return null;
		}
		if(newTitle != title)
			this.closeTiddler(newTitle,false);
		tiddlerElem.id = this.tiddlerId(newTitle);
		tiddlerElem.setAttribute("tiddler",newTitle);
		tiddlerElem.setAttribute("template",DEFAULT_VIEW_TEMPLATE);
		tiddlerElem.setAttribute("dirty","false");
		if(config.options.chkForceMinorUpdate)
			minorUpdate = !minorUpdate;
		if(!store.tiddlerExists(newTitle))
			minorUpdate = false;
		var newDate = new Date();
		if(store.tiddlerExists(title)) {
			var t = store.fetchTiddler(title);
			var extendedFields = t.fields;
			creator = t.creator;
		} else {
			extendedFields = merge({},config.defaultCustomFields);
		}
		for(var n in fields) {
			if(!TiddlyWiki.isStandardField(n))
				extendedFields[n] = fields[n];
		}
		var tiddler = store.saveTiddler(title,newTitle,fields.text,minorUpdate ? undefined : config.options.txtUserName,minorUpdate ? undefined : newDate,fields.tags,extendedFields,null,null,creator);
		autoSaveChanges(null,[tiddler]);
		return newTitle;
	}
	return null;
};

Story.prototype.permaView = function()
{
	var links = [];
	this.forEachTiddler(function(title,element) {
		links.push(String.encodeTiddlyLink(title));
	});
	var t = encodeURIComponent(links.join(" "));
	if(t == "")
		t = "#";
	if(window.location.hash != t)
		window.location.hash = t;
};

Story.prototype.switchTheme = function(theme)
{
	if(safeMode)
		return;

	var isAvailable = function(title) {
		var s = title ? title.indexOf(config.textPrimitives.sectionSeparator) : -1;
		if(s!=-1)
			title = title.substr(0,s);
		return store.tiddlerExists(title) || store.isShadowTiddler(title);
	};

	var getSlice = function(theme,slice) {
		var r;
		if(readOnly)
			r = store.getTiddlerSlice(theme,slice+"ReadOnly") || store.getTiddlerSlice(theme,"Web"+slice);
		r = r || store.getTiddlerSlice(theme,slice);
		if(r && r.indexOf(config.textPrimitives.sectionSeparator)==0)
			r = theme + r;
		return isAvailable(r) ? r : slice;
	};

	var replaceNotification = function(i,name,theme,slice) {
		var newName = getSlice(theme,slice);
		if(name!=newName && store.namedNotifications[i].name==name) {
			store.namedNotifications[i].name = newName;
			return newName;
		}
		return name;
	};

	var pt = config.refresherData.pageTemplate;
	var vi = DEFAULT_VIEW_TEMPLATE;
	var vt = config.tiddlerTemplates[vi];
	var ei = DEFAULT_EDIT_TEMPLATE;
	var et = config.tiddlerTemplates[ei];

	for(var i=0; i<config.notifyTiddlers.length; i++) {
		var name = config.notifyTiddlers[i].name;
		switch(name) {
		case "PageTemplate":
			config.refresherData.pageTemplate = replaceNotification(i,config.refresherData.pageTemplate,theme,name);
			break;
		case "StyleSheet":
			removeStyleSheet(config.refresherData.styleSheet);
			config.refresherData.styleSheet = replaceNotification(i,config.refresherData.styleSheet,theme,name);
			break;
		case "ColorPalette":
			config.refresherData.colorPalette = replaceNotification(i,config.refresherData.colorPalette,theme,name);
			break;
		default:
			break;
		}
	}
	config.tiddlerTemplates[vi] = getSlice(theme,"ViewTemplate");
	config.tiddlerTemplates[ei] = getSlice(theme,"EditTemplate");
	if(!startingUp) {
		if(config.refresherData.pageTemplate!=pt || config.tiddlerTemplates[vi]!=vt || config.tiddlerTemplates[ei]!=et) {
			refreshAll();
			this.refreshAllTiddlers(true);
		} else {
			setStylesheet(store.getRecursiveTiddlerText(config.refresherData.styleSheet,"",10),config.refreshers.styleSheet);
		}
		config.options.txtTheme = theme;
		saveOption("txtTheme");
	}
};

//--
//-- Backstage
//--

var backstage = {
	area: null,
	toolbar: null,
	button: null,
	showButton: null,
	hideButton: null,
	cloak: null,
	panel: null,
	panelBody: null,
	panelFooter: null,
	currTabName: null,
	currTabElem: null,
	content: null,

	init: function() {
		var cmb = config.messages.backstage;
		this.area = document.getElementById("backstageArea");
		this.toolbar = jQuery("#backstageToolbar").empty()[0];
		this.button = jQuery("#backstageButton").empty()[0];
		this.button.style.display = "block";
		var t = cmb.open.text + " " + glyph("bentArrowLeft");
		this.showButton = createTiddlyButton(this.button,t,cmb.open.tooltip,
						function(e) {backstage.show(); return false;},null,"backstageShow");
		t = glyph("bentArrowRight") + " " + cmb.close.text;
		this.hideButton = createTiddlyButton(this.button,t,cmb.close.tooltip,
						function(e) {backstage.hide(); return false;},null,"backstageHide");
		this.cloak = document.getElementById("backstageCloak");
		this.panel = document.getElementById("backstagePanel");
		this.panelFooter = createTiddlyElement(this.panel,"div",null,"backstagePanelFooter");
		this.panelBody = createTiddlyElement(this.panel,"div",null,"backstagePanelBody");
		this.cloak.onmousedown = function(e) {backstage.switchTab(null);};
		createTiddlyText(this.toolbar,cmb.prompt);
		for(t=0; t<config.backstageTasks.length; t++) {
			var taskName = config.backstageTasks[t];
			var task = config.tasks[taskName];
			var handler = task.action ? this.onClickCommand : this.onClickTab;
			var text = task.text + (task.action ? "" : glyph("downTriangle"));
			var btn = createTiddlyButton(this.toolbar,text,task.tooltip,handler,"backstageTab");
			addClass(btn,task.action ? "backstageAction" : "backstageTask");
			btn.setAttribute("task", taskName);
			}
		this.content = document.getElementById("contentWrapper");
		if(config.options.chkBackstage)
			this.show();
		else
			this.hide();
	},

	isVisible: function() {
		return this.area ? this.area.style.display == "block" : false;
	},

	show: function() {
		this.area.style.display = "block";
		if(anim && config.options.chkAnimate) {
			backstage.toolbar.style.left = findWindowWidth() + "px";
			var p = [{style: "left", start: findWindowWidth(), end: 0, template: "%0px"}];
			anim.startAnimating(new Morpher(backstage.toolbar,config.animDuration,p));
		} else {
			backstage.area.style.left = "0px";
		}
		jQuery(this.showButton).hide();
		jQuery(this.hideButton).show();
		config.options.chkBackstage = true;
		saveOption("chkBackstage");
		addClass(this.content,"backstageVisible");
	},

	hide: function() {
		if(this.currTabElem) {
			this.switchTab(null);
		} else {
			backstage.toolbar.style.left = "0px";
			if(anim && config.options.chkAnimate) {
				var p = [{style: "left", start: 0, end: findWindowWidth(), template: "%0px"}];
				var c = function(element,properties) {backstage.area.style.display = "none";};
				anim.startAnimating(new Morpher(backstage.toolbar,config.animDuration,p,c));
			} else {
				this.area.style.display = "none";
			}
			this.showButton.style.display = "block";
			this.hideButton.style.display = "none";
			config.options.chkBackstage = false;
			saveOption("chkBackstage");
			removeClass(this.content, "backstageVisible");
		}
	},

	onClickCommand: function(e) {
		var task = config.tasks[this.getAttribute("task")];
		if(task.action) {
			backstage.switchTab(null);
			task.action();
		}
		return false;
	},

	onClickTab: function(e) {
		backstage.switchTab(this.getAttribute("task"));
		return false;
	},

	// Switch to a given tab, or none if null is passed
	switchTab: function(tabName) {
		var tabElem = null;
		var e = this.toolbar.firstChild;
		while(e)
			{
			if(e.getAttribute && e.getAttribute("task") == tabName)
				tabElem = e;
			e = e.nextSibling;
			}
		if(tabName == backstage.currTabName) {
			backstage.hidePanel();
			return;
		}
		if(backstage.currTabElem) {
			removeClass(this.currTabElem, "backstageSelTab");
		}
		if(tabElem && tabName) {
			backstage.preparePanel();
			addClass(tabElem,"backstageSelTab");
			var task = config.tasks[tabName];
			wikify(task.content,backstage.panelBody,null,null);
			backstage.showPanel();
		} else if(backstage.currTabElem) {
			backstage.hidePanel();
		}
		backstage.currTabName = tabName;
		backstage.currTabElem = tabElem;
	},

	isPanelVisible: function() {
		return backstage.panel ? backstage.panel.style.display == "block" : false;
	},

	preparePanel: function() {
		backstage.cloak.style.height = findWindowHeight() + "px";
		backstage.cloak.style.display = "block";
		removeChildren(backstage.panelBody);
		return backstage.panelBody;
	},

	showPanel: function() {
		backstage.panel.style.display = "block";
		if(anim && config.options.chkAnimate) {
			backstage.panel.style.top = (-backstage.panel.offsetHeight) + "px";
			var p = [{style: "top", start: -backstage.panel.offsetHeight, end: 0, template: "%0px"}];
			anim.startAnimating(new Morpher(backstage.panel,config.animDuration,p),new Scroller(backstage.panel,false));
		} else {
			backstage.panel.style.top = "0px";
		}
		return backstage.panelBody;
	},

	hidePanel: function() {
		if(backstage.currTabElem)
			removeClass(backstage.currTabElem, "backstageSelTab");
		backstage.currTabElem = null;
		backstage.currTabName = null;
		if(anim && config.options.chkAnimate) {
			var p = [
				{style: "top", start: 0, end: -(backstage.panel.offsetHeight), template: "%0px"},
				{style: "display", atEnd: "none"}
			];
			var c = function(element,properties) {backstage.cloak.style.display = "none";};
			anim.startAnimating(new Morpher(backstage.panel,config.animDuration,p,c));
		} else {
			jQuery([backstage.panel,backstage.cloak]).hide();
		}
	}
};

config.macros.backstage = {};

config.macros.backstage.handler = function(place,macroName,params)
{
	var backstageTask = config.tasks[params[0]];
	if(backstageTask)
		createTiddlyButton(place,backstageTask.text,backstageTask.tooltip,function(e) {backstage.switchTab(params[0]); return false;});
};

//--
//-- ImportTiddlers macro
//--

config.macros.importTiddlers.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	if(readOnly) {
		createTiddlyElement(place,"div",null,"marked",this.readOnlyWarning);
		return;
	}
	var w = new Wizard();
	w.createWizard(place,this.wizardTitle);
	this.restart(w);
};

config.macros.importTiddlers.onCancel = function(e)
{
	var wizard = new Wizard(this);
	var place = wizard.clear();
	config.macros.importTiddlers.restart(wizard);
	return false;
};

config.macros.importTiddlers.onClose = function(e)
{
	backstage.hidePanel();
	return false;
};

config.macros.importTiddlers.restart = function(wizard)
{
	var me = config.macros.importTiddlers;
	wizard.addStep(this.step1Title,this.step1Html);
	var s = wizard.getElement("selTypes");
	for(var t in config.adaptors) {
		var e = createTiddlyElement(s,"option",null,null,config.adaptors[t].serverLabel ? config.adaptors[t].serverLabel : t);
		e.value = t;
	}
	if(config.defaultAdaptor)
		s.value = config.defaultAdaptor;
	s = wizard.getElement("selFeeds");
	var feeds = this.getFeeds();
	for(t in feeds) {
		e = createTiddlyElement(s,"option",null,null,t);
		e.value = t;
	}
	wizard.setValue("feeds",feeds);
	s.onchange = me.onFeedChange;
	var fileInput = wizard.getElement("txtBrowse");
	fileInput.onchange = me.onBrowseChange;
	fileInput.onkeyup = me.onBrowseChange;
	wizard.setButtons([{caption: this.openLabel, tooltip: this.openPrompt, onClick: me.onOpen}]);
	wizard.formElem.action = "javascript:;";
	wizard.formElem.onsubmit = function() {
		if(!this.txtPath || this.txtPath.value.length) //# check for manually entered path in first step
			this.lastChild.firstChild.onclick();
	};
};

config.macros.importTiddlers.getFeeds = function()
{
	var feeds = {};
	var tagged = store.getTaggedTiddlers("systemServer","title");
	for(var t=0; t<tagged.length; t++) {
		var title = tagged[t].title;
		var serverType = store.getTiddlerSlice(title,"Type");
		if(!serverType)
			serverType = "file";
		feeds[title] = {title: title,
						url: store.getTiddlerSlice(title,"URL"),
						workspace: store.getTiddlerSlice(title,"Workspace"),
						workspaceList: store.getTiddlerSlice(title,"WorkspaceList"),
						tiddlerFilter: store.getTiddlerSlice(title,"TiddlerFilter"),
						serverType: serverType,
						description: store.getTiddlerSlice(title,"Description")};
	}
	return feeds;
};

config.macros.importTiddlers.onFeedChange = function(e)
{
	var wizard = new Wizard(this);
	var selTypes = wizard.getElement("selTypes");
	var fileInput = wizard.getElement("txtPath");
	var feeds = wizard.getValue("feeds");
	var f = feeds[this.value];
	if(f) {
		selTypes.value = f.serverType;
		fileInput.value = f.url;
		wizard.setValue("feedName",f.serverType);
		wizard.setValue("feedHost",f.url);
		wizard.setValue("feedWorkspace",f.workspace);
		wizard.setValue("feedWorkspaceList",f.workspaceList);
		wizard.setValue("feedTiddlerFilter",f.tiddlerFilter);
	}
	return false;
};

config.macros.importTiddlers.onBrowseChange = function(e)
{
	var wizard = new Wizard(this);
	if(this.files && this.files[0]) {
		try {
			netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
		} catch (ex) {
			showException(ex);
		}
	}
	var fileInput = wizard.getElement("txtPath");
	fileInput.value = config.macros.importTiddlers.getURLFromLocalPath(this.value);
	var serverType = wizard.getElement("selTypes");
	serverType.value = "file";
	return true;
};

config.macros.importTiddlers.getURLFromLocalPath = function(v)
{
	if(!v || !v.length)
		return v;
	v = v.replace(/\\/g,"/"); // use "/" for cross-platform consistency
	var u;
	var t = v.split(":");
	var p = t[1] || t[0]; // remove drive letter (if any)
	if(t[1] && (t[0] == "http" || t[0] == "https" || t[0] == "file")) {
		u = v;
	} else if(p.substr(0,1)=="/") {
		u = document.location.protocol + "//" + document.location.hostname + (t[1] ? "/" : "") + v;
	} else {
		var c = document.location.href.replace(/\\/g,"/");
		var pos = c.lastIndexOf("/");
		if(pos!=-1)
			c = c.substr(0,pos); // remove filename
		u = c + "/" + p;
	}
	return u;
};

config.macros.importTiddlers.onOpen = function(e)
{
	var me = config.macros.importTiddlers;
	var wizard = new Wizard(this);
	var fileInput = wizard.getElement("txtPath");
	var url = fileInput.value;
	var serverType = wizard.getElement("selTypes").value || config.defaultAdaptor;
	var adaptor = new config.adaptors[serverType]();
	wizard.setValue("adaptor",adaptor);
	wizard.setValue("serverType",serverType);
	wizard.setValue("host",url);
	var ret = adaptor.openHost(url,null,wizard,me.onOpenHost);
	if(ret !== true)
		displayMessage(ret);
	wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenHost);
	return false;
};

config.macros.importTiddlers.onOpenHost = function(context,wizard)
{
	var me = config.macros.importTiddlers;
	var adaptor = wizard.getValue("adaptor");
	if(context.status !== true)
		displayMessage("Error in importTiddlers.onOpenHost: " + context.statusText);
	var ret = adaptor.getWorkspaceList(context,wizard,me.onGetWorkspaceList);
	if(ret !== true)
		displayMessage(ret);
	wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusGetWorkspaceList);
};

config.macros.importTiddlers.onGetWorkspaceList = function(context,wizard)
{
	var me = config.macros.importTiddlers;
	if(context.status !== true)
		displayMessage("Error in importTiddlers.onGetWorkspaceList: " + context.statusText);
	wizard.setValue("context",context);
	var workspace = wizard.getValue("feedWorkspace");
	if(!workspace && context.workspaces.length==1)
		workspace = context.workspaces[0].title;
	if(workspace) {
		var ret = context.adaptor.openWorkspace(workspace,context,wizard,me.onOpenWorkspace);
		if(ret !== true)
			displayMessage(ret);
		wizard.setValue("workspace",workspace);
		wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenWorkspace);
		return;
	}
	wizard.addStep(me.step2Title,me.step2Html);
	var s = wizard.getElement("selWorkspace");
	s.onchange = me.onWorkspaceChange;
	for(var t=0; t<context.workspaces.length; t++) {
		var e = createTiddlyElement(s,"option",null,null,context.workspaces[t].title);
		e.value = context.workspaces[t].title;
	}
	var workspaceList = wizard.getValue("feedWorkspaceList");
	if(workspaceList) {
		var list = workspaceList.parseParams("workspace",null,false,true);
		for(var n=1; n<list.length; n++) {
			if(context.workspaces.findByField("title",list[n].value) == null) {
				e = createTiddlyElement(s,"option",null,null,list[n].value);
				e.value = list[n].value;
			}
		}
	}
	if(workspace) {
		t = wizard.getElement("txtWorkspace");
		t.value = workspace;
	}
	wizard.setButtons([{caption: me.openLabel, tooltip: me.openPrompt, onClick: me.onChooseWorkspace}]);
};

config.macros.importTiddlers.onWorkspaceChange = function(e)
{
	var wizard = new Wizard(this);
	var t = wizard.getElement("txtWorkspace");
	t.value = this.value;
	this.selectedIndex = 0;
	return false;
};

config.macros.importTiddlers.onChooseWorkspace = function(e)
{
	var me = config.macros.importTiddlers;
	var wizard = new Wizard(this);
	var adaptor = wizard.getValue("adaptor");
	var workspace = wizard.getElement("txtWorkspace").value;
	wizard.setValue("workspace",workspace);
	var context = wizard.getValue("context");
	var ret = adaptor.openWorkspace(workspace,context,wizard,me.onOpenWorkspace);
	if(ret !== true)
		displayMessage(ret);
	wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenWorkspace);
	return false;
};

config.macros.importTiddlers.onOpenWorkspace = function(context,wizard)
{
	var me = config.macros.importTiddlers;
	if(context.status !== true)
		displayMessage("Error in importTiddlers.onOpenWorkspace: " + context.statusText);
	var adaptor = wizard.getValue("adaptor");
	var ret = adaptor.getTiddlerList(context,wizard,me.onGetTiddlerList,wizard.getValue("feedTiddlerFilter"));
	if(ret !== true)
		displayMessage(ret);
	wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusGetTiddlerList);
};

config.macros.importTiddlers.onGetTiddlerList = function(context,wizard)
{
	var me = config.macros.importTiddlers;
	if(context.status !== true) {
		wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.errorGettingTiddlerList);
		return;
	}
	// Extract data for the listview
	var listedTiddlers = [];
	if(context.tiddlers) {
		for(var n=0; n<context.tiddlers.length; n++) {
			var tiddler = context.tiddlers[n];
			listedTiddlers.push({
				title: tiddler.title,
				modified: tiddler.modified,
				modifier: tiddler.modifier,
				text: tiddler.text ? wikifyPlainText(tiddler.text,100) : "",
				tags: tiddler.tags,
				size: tiddler.text ? tiddler.text.length : 0,
				tiddler: tiddler
			});
		}
	}
	listedTiddlers.sort(function(a,b) {return a.title < b.title ? -1 : (a.title == b.title ? 0 : +1);});
	// Display the listview
	wizard.addStep(me.step3Title,me.step3Html);
	var markList = wizard.getElement("markList");
	var listWrapper = document.createElement("div");
	markList.parentNode.insertBefore(listWrapper,markList);
	var listView = ListView.create(listWrapper,listedTiddlers,me.listViewTemplate);
	wizard.setValue("listView",listView);
	wizard.setValue("context",context);
	var txtSaveTiddler = wizard.getElement("txtSaveTiddler");
	txtSaveTiddler.value = me.generateSystemServerName(wizard);
	wizard.setButtons([
			{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel},
			{caption: me.importLabel, tooltip: me.importPrompt, onClick: me.doImport}
		]);
};

config.macros.importTiddlers.generateSystemServerName = function(wizard)
{
	var serverType = wizard.getValue("serverType");
	var host = wizard.getValue("host");
	var workspace = wizard.getValue("workspace");
	var pattern = config.macros.importTiddlers[workspace ? "systemServerNamePattern" : "systemServerNamePatternNoWorkspace"];
	return pattern.format([serverType,host,workspace]);
};

config.macros.importTiddlers.saveServerTiddler = function(wizard)
{
	var me = config.macros.importTiddlers;
	var txtSaveTiddler = wizard.getElement("txtSaveTiddler").value;
	if(store.tiddlerExists(txtSaveTiddler)) {
		if(!confirm(me.confirmOverwriteSaveTiddler.format([txtSaveTiddler])))
			return;
		store.suspendNotifications();
		store.removeTiddler(txtSaveTiddler);
		store.resumeNotifications();
	}
	var serverType = wizard.getValue("serverType");
	var host = wizard.getValue("host");
	var workspace = wizard.getValue("workspace");
	var text = me.serverSaveTemplate.format([serverType,host,workspace]);
	store.saveTiddler(txtSaveTiddler,txtSaveTiddler,text,me.serverSaveModifier,new Date(),["systemServer"]);
};

config.macros.importTiddlers.doImport = function(e)
{
	var me = config.macros.importTiddlers;
	var wizard = new Wizard(this);
	if(wizard.getElement("chkSave").checked)
		me.saveServerTiddler(wizard);
	var chkSync = wizard.getElement("chkSync").checked;
	wizard.setValue("sync",chkSync);
	var listView = wizard.getValue("listView");
	var rowNames = ListView.getSelectedRows(listView);
	var adaptor = wizard.getValue("adaptor");
	var overwrite = [];
	var t;
	for(t=0; t<rowNames.length; t++) {
		if(store.tiddlerExists(rowNames[t]))
			overwrite.push(rowNames[t]);
	}
	if(overwrite.length > 0) {
		if(!confirm(me.confirmOverwriteText.format([overwrite.join(", ")])))
			return false;
	}
	wizard.addStep(me.step4Title.format([rowNames.length]),me.step4Html);
	for(t=0; t<rowNames.length; t++) {
		var link = document.createElement("div");
		createTiddlyLink(link,rowNames[t],true);
		var place = wizard.getElement("markReport");
		place.parentNode.insertBefore(link,place);
	}
	wizard.setValue("remainingImports",rowNames.length);
	wizard.setButtons([
			{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}
		],me.statusDoingImport);
	var wizardContext = wizard.getValue("context");
	var tiddlers = wizardContext ? wizardContext.tiddlers : [];
	for(t=0; t<rowNames.length; t++) {
		var context = {
			allowSynchronous:true,
			tiddler:tiddlers[tiddlers.findByField("title",rowNames[t])]
		};
		adaptor.getTiddler(rowNames[t],context,wizard,me.onGetTiddler);
	}
	return false;
};

config.macros.importTiddlers.onGetTiddler = function(context,wizard)
{
	var me = config.macros.importTiddlers;
	if(!context.status)
		displayMessage("Error in importTiddlers.onGetTiddler: " + context.statusText);
	var tiddler = context.tiddler;
	store.suspendNotifications();
	store.saveTiddler(tiddler.title, tiddler.title, tiddler.text, tiddler.modifier, tiddler.modified, tiddler.tags, tiddler.fields, true, tiddler.created);
	if(!wizard.getValue("sync")) {
		store.setValue(tiddler.title,'server',null);
	}
	store.resumeNotifications();
	if(!context.isSynchronous)
		store.notify(tiddler.title,true);
	var remainingImports = wizard.getValue("remainingImports")-1;
	wizard.setValue("remainingImports",remainingImports);
	if(remainingImports == 0) {
		if(context.isSynchronous) {
			store.notifyAll();
			refreshDisplay();
		}
		wizard.setButtons([
				{caption: me.doneLabel, tooltip: me.donePrompt, onClick: me.onClose}
			],me.statusDoneImport);
		autoSaveChanges();
	}
};

//--
//-- Upgrade macro
//--

config.macros.upgrade.handler = function(place)
{
	var w = new Wizard();
	w.createWizard(place,this.wizardTitle);
	w.addStep(this.step1Title,this.step1Html.format([this.source,this.source]));
	w.setButtons([{caption: this.upgradeLabel, tooltip: this.upgradePrompt, onClick: this.onClickUpgrade}]);
};

config.macros.upgrade.onClickUpgrade = function(e)
{
	var me = config.macros.upgrade;
	var w = new Wizard(this);
	if(window.location.protocol != "file:") {
		alert(me.errorCantUpgrade);
		return false;
	}
	if(story.areAnyDirty() || store.isDirty()) {
		alert(me.errorNotSaved);
		return false;
	}
	var localPath = getLocalPath(document.location.toString());
	var backupPath = getBackupPath(localPath,me.backupExtension);
	w.setValue("backupPath",backupPath);
	w.setButtons([],me.statusPreparingBackup);
	var original = loadOriginal(localPath);
	w.setButtons([],me.statusSavingBackup);
	var backup = copyFile(backupPath,localPath);
	if(!backup)
		backup = saveFile(backupPath,original);
	if(!backup) {
		w.setButtons([],me.errorSavingBackup);
		alert(me.errorSavingBackup);
		return false;
	}
	w.setButtons([],me.statusLoadingCore);
	var load = loadRemoteFile(me.source,me.onLoadCore,w);
	if(typeof load == "string") {
		w.setButtons([],me.errorLoadingCore);
		alert(me.errorLoadingCore);
		return false;
	}
	return false;
};

config.macros.upgrade.onLoadCore = function(status,params,responseText,url,xhr)
{
	var me = config.macros.upgrade;
	var w = params;
	var errMsg;
	if(!status)
		errMsg = me.errorLoadingCore;
	var newVer = me.extractVersion(responseText);
	if(!newVer)
		errMsg = me.errorCoreFormat;
	if(errMsg) {
		w.setButtons([],errMsg);
		alert(errMsg);
		return;
	}
	var onStartUpgrade = function(e) {
		w.setButtons([],me.statusSavingCore);
		var localPath = getLocalPath(document.location.toString());
		saveFile(localPath,responseText);
		w.setButtons([],me.statusReloadingCore);
		var backupPath = w.getValue("backupPath");
		var newLoc = document.location.toString() + "?time=" + new Date().convertToYYYYMMDDHHMM() + "#upgrade:[[" + encodeURI(backupPath) + "]]";
		window.setTimeout(function () {window.location = newLoc;},10);
	};
	var step2 = [me.step2Html_downgrade,me.step2Html_restore,me.step2Html_upgrade][compareVersions(version,newVer) + 1];
	w.addStep(me.step2Title,step2.format([formatVersion(newVer),formatVersion(version)]));
	w.setButtons([{caption: me.startLabel, tooltip: me.startPrompt, onClick: onStartUpgrade},{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}]);
};

config.macros.upgrade.onCancel = function(e)
{
	var me = config.macros.upgrade;
	var w = new Wizard(this);
	w.addStep(me.step3Title,me.step3Html);
	w.setButtons([]);
	return false;
};

config.macros.upgrade.extractVersion = function(upgradeFile)
{
	var re = /^var version = \{title: "([^"]+)", major: (\d+), minor: (\d+), revision: (\d+)(, beta: (\d+)){0,1}, date: new Date\("([^"]+)"\)/mg;
	var m = re.exec(upgradeFile);
	return m ? {title: m[1], major: m[2], minor: m[3], revision: m[4], beta: m[6], date: new Date(m[7])} : null;
};

function upgradeFrom(path)
{
	var importStore = new TiddlyWiki();
	var tw = loadFile(path);
	if(window.netscape !== undefined)
		tw = convertUTF8ToUnicode(tw);
	importStore.importTiddlyWiki(tw);
	importStore.forEachTiddler(function(title,tiddler) {
		if(!store.getTiddler(title)) {
			store.addTiddler(tiddler);
		}
	});
	refreshDisplay();
	saveChanges(); //# To create appropriate Markup* sections
	alert(config.messages.upgradeDone.format([formatVersion()]));
	window.location = window.location.toString().substr(0,window.location.toString().lastIndexOf("?"));
}

//--
//-- Sync macro
//--

// Synchronisation handlers
config.syncers = {};

// Sync state.
var currSync = null;

// sync macro
config.macros.sync.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	if(!wikifier.isStatic)
		this.startSync(place);
};

config.macros.sync.cancelSync = function()
{
	currSync = null;
};

config.macros.sync.startSync = function(place)
{
	if(currSync)
		config.macros.sync.cancelSync();
	currSync = {};
	currSync.syncList = this.getSyncableTiddlers();
	currSync.syncTasks = this.createSyncTasks(currSync.syncList);
	this.preProcessSyncableTiddlers(currSync.syncList);
	var wizard = new Wizard();
	currSync.wizard = wizard;
	wizard.createWizard(place,this.wizardTitle);
	wizard.addStep(this.step1Title,this.step1Html);
	var markList = wizard.getElement("markList");
	var listWrapper = document.createElement("div");
	markList.parentNode.insertBefore(listWrapper,markList);
	currSync.listView = ListView.create(listWrapper,currSync.syncList,this.listViewTemplate);
	this.processSyncableTiddlers(currSync.syncList);
	wizard.setButtons([{caption: this.syncLabel, tooltip: this.syncPrompt, onClick: this.doSync}]);
};

config.macros.sync.getSyncableTiddlers = function()
{
	var list = [];
	store.forEachTiddler(function(title,tiddler) {
		var syncItem = {};
		syncItem.serverType = tiddler.getServerType();
		syncItem.serverHost = tiddler.fields['server.host'];
		if(syncItem.serverType && syncItem.serverHost) {
			syncItem.adaptor = new config.adaptors[syncItem.serverType];
			syncItem.serverHost = syncItem.adaptor.fullHostName(syncItem.serverHost);
			syncItem.serverWorkspace = tiddler.fields['server.workspace'];
			syncItem.tiddler = tiddler;
			syncItem.title = tiddler.title;
			syncItem.isTouched = tiddler.isTouched();
			syncItem.selected = syncItem.isTouched;
			syncItem.syncStatus = config.macros.sync.syncStatusList[syncItem.isTouched ? "changedLocally" : "none"];
			syncItem.status = syncItem.syncStatus.text;
			list.push(syncItem);
		}
		});
	list.sort(function(a,b) {return a.title < b.title ? -1 : (a.title == b.title ? 0 : +1);});
	return list;
};

config.macros.sync.preProcessSyncableTiddlers = function(syncList)
{
	for(var i=0; i<syncList.length; i++) {
		var si = syncList[i];
		si.serverUrl = si.adaptor.generateTiddlerInfo(si.tiddler).uri;
	}
};

config.macros.sync.processSyncableTiddlers = function(syncList)
{
	for(var i=0; i<syncList.length; i++) {
		var si = syncList[i];
		if(si.syncStatus.display)
			si.rowElement.style.display = si.syncStatus.display;
		if(si.syncStatus.className)
			si.rowElement.className = si.syncStatus.className;
	}
};

config.macros.sync.createSyncTasks = function(syncList)
{
	var syncTasks = [];
	for(var i=0; i<syncList.length; i++) {
		var si = syncList[i];
		var r = null;
		for(var j=0; j<syncTasks.length; j++) {
			var cst = syncTasks[j];
			if(si.serverType == cst.serverType && si.serverHost == cst.serverHost && si.serverWorkspace == cst.serverWorkspace)
				r = cst;
		}
		if(r) {
			si.syncTask = r;
			r.syncItems.push(si);
		} else {
			si.syncTask = this.createSyncTask(si);
			syncTasks.push(si.syncTask);
		}
	}
	return syncTasks;
};

config.macros.sync.createSyncTask = function(syncItem)
{
	var st = {};
	st.serverType = syncItem.serverType;
	st.serverHost = syncItem.serverHost;
	st.serverWorkspace = syncItem.serverWorkspace;
	st.syncItems = [syncItem];

	var openWorkspaceCallback = function(context,syncItems) {
		if(context.status) {
			context.adaptor.getTiddlerList(context,syncItems,getTiddlerListCallback);
			return true;
		}
		displayMessage(context.statusText);
		return false;
	};

	var getTiddlerListCallback = function(context,sycnItems) {
		var me = config.macros.sync;
		if(!context.status) {
			displayMessage(context.statusText);
			return false;
		}
		syncItems = context.userParams;
		var tiddlers = context.tiddlers;
		for(var i=0; i<syncItems.length; i++) {
			var si = syncItems[i];
			var f = tiddlers.findByField("title",si.title);
			if(f !== null) {
				if(tiddlers[f].fields['server.page.revision'] > si.tiddler.fields['server.page.revision']) {
					si.syncStatus = me.syncStatusList[si.isTouched ? 'changedBoth' : 'changedServer'];
				}
			} else {
				si.syncStatus = me.syncStatusList.notFound;
			}
			me.updateSyncStatus(si);
		}
		return true;
	};
	var context = {host:st.serverHost,workspace:st.serverWorkspace};
	syncItem.adaptor.openHost(st.serverHost);
	syncItem.adaptor.openWorkspace(st.serverWorkspace,context,st.syncItems,openWorkspaceCallback);
	return st;
};

config.macros.sync.updateSyncStatus = function(syncItem)
{
	var e = syncItem.colElements["status"];
	removeChildren(e);
	createTiddlyText(e,syncItem.syncStatus.text);
	syncItem.rowElement.style.display = syncItem.syncStatus.display;
	if(syncItem.syncStatus.className)
		syncItem.rowElement.className = syncItem.syncStatus.className;
};

config.macros.sync.doSync = function(e)
{
	var me = config.macros.sync;
	var getTiddlerCallback = function(context,syncItem) {
		if(syncItem) {
			var tiddler = context.tiddler;
			store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields,true,tiddler.created);
			syncItem.syncStatus = me.syncStatusList.gotFromServer;
			me.updateSyncStatus(syncItem);
		}
	};
	var putTiddlerCallback = function(context,syncItem) {
		if(syncItem) {
			store.resetTiddler(context.title);
			syncItem.syncStatus = me.syncStatusList.putToServer;
			me.updateSyncStatus(syncItem);
		}
	};

	var rowNames = ListView.getSelectedRows(currSync.listView);
	var sl = me.syncStatusList;
	for(var i=0; i<currSync.syncList.length; i++) {
		var si = currSync.syncList[i];
		if(rowNames.indexOf(si.title) != -1) {
			var errorMsg = "Error in doSync: ";
			try {
				var r = true;
				switch(si.syncStatus) {
				case sl.changedServer:
					var context = {"workspace": si.serverWorkspace};
					r = si.adaptor.getTiddler(si.title,context,si,getTiddlerCallback);
					break;
				case sl.notFound:
				case sl.changedLocally:
				case sl.changedBoth:
					r = si.adaptor.putTiddler(si.tiddler,null,si,putTiddlerCallback);
					break;
				default:
					break;
				}
				if(!r)
					displayMessage(errorMsg + r);
			} catch(ex) {
				if(ex.name == "TypeError")
					displayMessage("sync operation unsupported: " + ex.message);
				else
					displayMessage(errorMsg + ex.message);
			}
		}
	}
	return false;
};

//--
//-- Manager UI for groups of tiddlers
//--

config.macros.plugins.handler = function(place,macroName,params,wikifier,paramString)
{
	var wizard = new Wizard();
	wizard.createWizard(place,this.wizardTitle);
	wizard.addStep(this.step1Title,this.step1Html);
	var markList = wizard.getElement("markList");
	var listWrapper = document.createElement("div");
	markList.parentNode.insertBefore(listWrapper,markList);
	listWrapper.setAttribute("refresh","macro");
	listWrapper.setAttribute("macroName","plugins");
	listWrapper.setAttribute("params",paramString);
	this.refresh(listWrapper,paramString);
};

config.macros.plugins.refresh = function(listWrapper,params)
{
	var me = config.macros.plugins;
	var wizard = new Wizard(listWrapper);
	var selectedRows = [];
	ListView.forEachSelector(listWrapper,function(e,rowName) {
			if(e.checked)
				selectedRows.push(e.getAttribute("rowName"));
		});
	removeChildren(listWrapper);
	params = params.parseParams("anon");
	var plugins = installedPlugins.slice(0);
	var t,tiddler,p;
	var configTiddlers = store.getTaggedTiddlers("systemConfig");
	for(t=0; t<configTiddlers.length; t++) {
		tiddler = configTiddlers[t];
		if(plugins.findByField("title",tiddler.title) == null) {
			p = getPluginInfo(tiddler);
			p.executed = false;
			p.log.splice(0,0,this.skippedText);
			plugins.push(p);
		}
	}
	for(t=0; t<plugins.length; t++) {
		p = plugins[t];
		p.size = p.tiddler.text ? p.tiddler.text.length : 0;
		p.forced = p.tiddler.isTagged("systemConfigForce");
		p.disabled = p.tiddler.isTagged("systemConfigDisable");
		p.Selected = selectedRows.indexOf(plugins[t].title) != -1;
	}
	if(plugins.length == 0) {
		createTiddlyElement(listWrapper,"em",null,null,this.noPluginText);
		wizard.setButtons([]);
	} else {
		var template = readOnly ? this.listViewTemplateReadOnly : this.listViewTemplate;
		var listView = ListView.create(listWrapper,plugins,template,this.onSelectCommand);
		wizard.setValue("listView",listView);
		if(!readOnly) {
			wizard.setButtons([
				{caption: me.removeLabel, tooltip: me.removePrompt, onClick: me.doRemoveTag},
				{caption: me.deleteLabel, tooltip: me.deletePrompt, onClick: me.doDelete}
			]);
		}
	}
};

config.macros.plugins.doRemoveTag = function(e)
{
	var wizard = new Wizard(this);
	var listView = wizard.getValue("listView");
	var rowNames = ListView.getSelectedRows(listView);
	if(rowNames.length == 0) {
		alert(config.messages.nothingSelected);
	} else {
		for(var t=0; t<rowNames.length; t++)
			store.setTiddlerTag(rowNames[t],false,"systemConfig");
	}
};

config.macros.plugins.doDelete = function(e)
{
	var wizard = new Wizard(this);
	var listView = wizard.getValue("listView");
	var rowNames = ListView.getSelectedRows(listView);
	if(rowNames.length == 0) {
		alert(config.messages.nothingSelected);
	} else {
		if(confirm(config.macros.plugins.confirmDeleteText.format([rowNames.join(", ")]))) {
			for(var t=0; t<rowNames.length; t++) {
				store.removeTiddler(rowNames[t]);
				story.closeTiddler(rowNames[t],true);
			}
		}
	}
};

//--
//-- Message area
//--

function getMessageDiv()
{
	var msgArea = document.getElementById("messageArea");
	if(!msgArea)
		return null;
	if(!msgArea.hasChildNodes())
		createTiddlyButton(createTiddlyElement(msgArea,"div",null,"messageToolbar"),
			config.messages.messageClose.text,
			config.messages.messageClose.tooltip,
			clearMessage);
	msgArea.style.display = "block";
	return createTiddlyElement(msgArea,"div");
}

function displayMessage(text,linkText)
{
	var e = getMessageDiv();
	if(!e) {
		alert(text);
		return;
	}
	if(linkText) {
		var link = createTiddlyElement(e,"a",null,null,text);
		link.href = linkText;
		link.target = "_blank";
	} else {
		e.appendChild(document.createTextNode(text));
	}
}

function clearMessage()
{
	var msgArea = document.getElementById("messageArea");
	if(msgArea) {
		removeChildren(msgArea);
		msgArea.style.display = "none";
	}
	return false;
}

//--
//-- Refresh mechanism
//--

config.notifyTiddlers = [
	{name: "SystemSettings", notify: onSystemSettingsChange},
	{name: "StyleSheetLayout", notify: refreshStyles},
	{name: "StyleSheetColors", notify: refreshStyles},
	{name: "StyleSheet", notify: refreshStyles},
	{name: "StyleSheetPrint", notify: refreshStyles},
	{name: "PageTemplate", notify: refreshPageTemplate},
	{name: "SiteTitle", notify: refreshPageTitle},
	{name: "SiteSubtitle", notify: refreshPageTitle},
	{name: "WindowTitle", notify: refreshPageTitle},
	{name: "ColorPalette", notify: refreshColorPalette},
	{name: null, notify: refreshDisplay}
];

config.refreshers = {
	link: function(e,changeList)
		{
		var title = e.getAttribute("tiddlyLink");
		refreshTiddlyLink(e,title);
		return true;
		},

	tiddler: function(e,changeList)
		{
		var title = e.getAttribute("tiddler");
		var template = e.getAttribute("template");
		if(changeList && (changeList.indexOf && changeList.indexOf(title) != -1) && !story.isDirty(title))
			story.refreshTiddler(title,template,true);
		else
			refreshElements(e,changeList);
		return true;
		},

	content: function(e,changeList)
		{
		var title = e.getAttribute("tiddler");
		var force = e.getAttribute("force");
		var args = e.getAttribute("args");
		if(force != null || changeList == null || (changeList.indexOf && changeList.indexOf(title) != -1)) {
			removeChildren(e);
			config.macros.tiddler.transclude(e,title,args);
			return true;
		} else
			return false;
		},

	macro: function(e,changeList)
		{
		var macro = e.getAttribute("macroName");
		var params = e.getAttribute("params");
		if(macro)
			macro = config.macros[macro];
		if(macro && macro.refresh)
			macro.refresh(e,params);
		return true;
		}
};

config.refresherData = {
	styleSheet: "StyleSheet",
	defaultStyleSheet: "StyleSheet",
	pageTemplate: "PageTemplate",
	defaultPageTemplate: "PageTemplate",
	colorPalette: "ColorPalette",
	defaultColorPalette: "ColorPalette"
};

function refreshElements(root,changeList)
{
	var nodes = root.childNodes;
	for(var c=0; c<nodes.length; c++) {
		var e = nodes[c], type = null;
		if(e.getAttribute && (e.tagName ? e.tagName != "IFRAME" : true))
			type = e.getAttribute("refresh");
		var refresher = config.refreshers[type];
		var refreshed = false;
		if(refresher != undefined)
			refreshed = refresher(e,changeList);
		if(e.hasChildNodes() && !refreshed)
			refreshElements(e,changeList);
	}
}

function applyHtmlMacros(root,tiddler)
{
	var e = root.firstChild;
	while(e) {
		var nextChild = e.nextSibling;
		if(e.getAttribute) {
			var macro = e.getAttribute("macro");
			if(macro) {
				e.removeAttribute("macro");
				var params = "";
				var p = macro.indexOf(" ");
				if(p != -1) {
					params = macro.substr(p+1);
					macro = macro.substr(0,p);
				}
				invokeMacro(e,macro,params,null,tiddler);
			}
		}
		if(e.hasChildNodes())
			applyHtmlMacros(e,tiddler);
		e = nextChild;
	}
}

function refreshPageTemplate(title)
{
	var stash = jQuery("<div/>").appendTo("body").hide()[0];
	var display = story.getContainer();
	var nodes,t;
	if(display) {
		nodes = display.childNodes;
		for(t=nodes.length-1; t>=0; t--)
			stash.appendChild(nodes[t]);
	}
	var wrapper = document.getElementById("contentWrapper");

	var isAvailable = function(title) {
		var s = title ? title.indexOf(config.textPrimitives.sectionSeparator) : -1;
		if(s!=-1)
			title = title.substr(0,s);
		return store.tiddlerExists(title) || store.isShadowTiddler(title);
	};
	if(!title || !isAvailable(title))
		title = config.refresherData.pageTemplate;
	if(!isAvailable(title))
		title = config.refresherData.defaultPageTemplate; //# this one is always avaialable
	wrapper.innerHTML = store.getRecursiveTiddlerText(title,null,10);
	applyHtmlMacros(wrapper);
	refreshElements(wrapper);
	display = story.getContainer();
	removeChildren(display);
	if(!display)
		display = createTiddlyElement(wrapper,"div",story.containerId());
	nodes = stash.childNodes;
	for(t=nodes.length-1; t>=0; t--)
		display.appendChild(nodes[t]);
	removeNode(stash);
}

function refreshDisplay(hint)
{
	if(typeof hint == "string")
		hint = [hint];
	var e = document.getElementById("contentWrapper");
	refreshElements(e,hint);
	if(backstage.isPanelVisible()) {
		e = document.getElementById("backstage");
		refreshElements(e,hint);
	}
}

function refreshPageTitle()
{
	document.title = getPageTitle();
}

function getPageTitle()
{
	return wikifyPlain("WindowTitle");
}

function refreshStyles(title,doc)
{
	setStylesheet(title == null ? "" : store.getRecursiveTiddlerText(title,"",10),title,doc || document);
}

function refreshColorPalette(title)
{
	if(!startingUp)
		refreshAll();
}

function refreshAll()
{
	refreshPageTemplate();
	refreshDisplay();
	refreshStyles("StyleSheetLayout");
	refreshStyles("StyleSheetColors");
	refreshStyles(config.refresherData.styleSheet);
	refreshStyles("StyleSheetPrint");
}

//--
//-- Option handling
//--

config.optionHandlers = {
	'txt': {
		get: function(name) {return encodeCookie(config.options[name].toString());},
		set: function(name,value) {config.options[name] = decodeCookie(value);}
	},
	'chk': {
		get: function(name) {return config.options[name] ? 'true' : 'false';},
		set: function(name,value) {config.options[name] = value == 'true';}
	}
};

function setOption(name,value)
{
	var optType = name.substr(0,3);
	if(config.optionHandlers[optType] && config.optionHandlers[optType].set)
		config.optionHandlers[optType].set(name,value);
}

// Gets the value of an option as a string. Most code should just read from config.options.* directly
function getOption(name)
{
	var optType = name.substr(0,3);
	return config.optionHandlers[optType] && config.optionHandlers[optType].get ? config.optionHandlers[optType].get(name) : null;
}

function loadOptions()
{
	if(safeMode)
		return;
	loadCookies();
	loadSystemSettings();
}
// @Deprecated; retained for backwards compatibility
var loadOptionsCookie = loadOptions;

function getCookies()
{
	var cookieList = document.cookie.split(';');
	var cookies = {};
	for(var i=0; i<cookieList.length; i++) {
		var p = cookieList[i].indexOf('=');
		if(p != -1) {
			var name = cookieList[i].substr(0,p).trim();
			var value = cookieList[i].substr(p+1).trim();
			cookies[name] = value;
		}
	}
	return cookies;
}

function loadCookies()
{
	var cookies = getCookies();
	if(cookies['TiddlyWiki']) {
		cookies = cookies['TiddlyWiki'].decodeHashMap();
	}
	for(var i in cookies) {
		if(config.optionsSource[i] != 'setting') {
			setOption(i,cookies[i]);
		}
	}
}

function loadSystemSettings()
{
	var settings = store.calcAllSlices('SystemSettings');
	config.optionsSource = {};
	for(var key in settings) {
		setOption(key,settings[key]);
		config.optionsSource[key] = 'setting';
	}
}

function onSystemSettingsChange()
{
	if(!startingUp) {
		loadSystemSettings();
	}
}

function saveOption(name)
{
	if(safeMode)
		return;
	if(name.match(/[()\s]/g, '_')) {
		alert(config.messages.invalidCookie.format([name]));
		return;
	}
	saveCookie(name);
	if(config.optionsSource[name] == 'setting') {
		saveSystemSetting(name,true);
	}
}
// @Deprecated; retained for backwards compatibility
var saveOptionCookie = saveOption;

function removeCookie(name)
{
	document.cookie = name + '=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;';
}

function saveCookie(name)
{
	var cookies = {};
	for(var key in config.options) {
		var value = getOption(key);
		value = value == null ? 'false' : value;
		cookies[key] = value;
	}
	document.cookie = 'TiddlyWiki=' + String.encodeHashMap(cookies) + '; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/';
	cookies = getCookies();
	for(var c in cookies) {
		var optType = c.substr(0,3);
		if(config.optionHandlers[optType])
			removeCookie(c);
	}
}

function saveSystemSetting(name,saveFile)
{
	var title = 'SystemSettings';
	var slice = store.getTiddlerSlice(title,name);
	if(readOnly || slice === getOption(name)) {
		return; //# don't save if read-only or the option hasn't changed
	}
	var slices = store.calcAllSlices(title);
	var key;
	for(key in config.optionsSource) {
		var value = getOption(key) || '';
		if(slices[key] !== value) {
			slices[key] = value;
		}
	}
	var text = [];
	for(key in slices) {
		text.push('%0: %1'.format([key,slices[key]]));
	}
	text = text.sort().join('\n');
	var storeWasDirty = store.isDirty();
	var tiddler = store.getTiddler(title);
	if(tiddler) {
		tiddler.text = text;
		tiddler = store.saveTiddler(tiddler);
	} else {
		tiddler = store.saveTiddler(title,title,text,'System',new Date(),['excludeLists'],config.defaultCustomFields);
	}
	if(saveFile) {
		if(storeWasDirty == false && story.areAnyDirty() == false) {
			saveChanges(null,[tiddler]);
		} else {
			autoSaveChanges(null,[tiddler]);
		
		}
    }
}

function encodeCookie(s)
{
	return escape(convertUnicodeToHtmlEntities(s));
}

function decodeCookie(s)
{
	s = unescape(s);
	var re = /&#[0-9]{1,5};/g;
	return s.replace(re,function($0) {return String.fromCharCode(eval($0.replace(/[&#;]/g,'')));});
}

config.macros.option.genericCreate = function(place,type,opt,className,desc)
{
	var typeInfo = config.macros.option.types[type];
	var c = document.createElement(typeInfo.elementType);
	if(typeInfo.typeValue)
		c.setAttribute('type',typeInfo.typeValue);
	c[typeInfo.eventName] = typeInfo.onChange;
	c.setAttribute('option',opt);
	c.className = className || typeInfo.className;
	if(config.optionsDesc[opt])
		c.setAttribute('title',config.optionsDesc[opt]);
	place.appendChild(c);
	if(desc != 'no')
		createTiddlyText(place,config.optionsDesc[opt] || opt);
	c[typeInfo.valueField] = config.options[opt];
	return c;
};

config.macros.option.genericOnChange = function(e)
{
	var opt = this.getAttribute('option');
	if(opt) {
		var optType = opt.substr(0,3);
		var handler = config.macros.option.types[optType];
		if(handler.elementType && handler.valueField)
			config.macros.option.propagateOption(opt,handler.valueField,this[handler.valueField],handler.elementType,this);
	}
	return true;
};

config.macros.option.types = {
	'txt': {
		elementType: 'input',
		valueField: 'value',
		eventName: 'onchange',
		className: 'txtOptionInput',
		create: config.macros.option.genericCreate,
		onChange: config.macros.option.genericOnChange
	},
	'chk': {
		elementType: 'input',
		valueField: 'checked',
		eventName: 'onclick',
		className: 'chkOptionInput',
		typeValue: 'checkbox',
		create: config.macros.option.genericCreate,
		onChange: config.macros.option.genericOnChange
	}
};

config.macros.option.propagateOption = function(opt,valueField,value,elementType,elem)
{
	config.options[opt] = value;
	saveOption(opt);
	var nodes = document.getElementsByTagName(elementType);
	for(var t=0; t<nodes.length; t++) {
		var optNode = nodes[t].getAttribute('option');
		if(opt == optNode && nodes[t]!=elem)
			nodes[t][valueField] = value;
	}
};

config.macros.option.handler = function(place,macroName,params,wikifier,paramString)
{
	params = paramString.parseParams('anon',null,true,false,false);
	var opt = (params[1] && params[1].name == 'anon') ? params[1].value : getParam(params,'name',null);
	var className = (params[2] && params[2].name == 'anon') ? params[2].value : getParam(params,'class',null);
	var desc = getParam(params,'desc','no');
	var type = opt.substr(0,3);
	var h = config.macros.option.types[type];
	if(h && h.create)
		h.create(place,type,opt,className,desc);
};

config.macros.options.handler = function(place,macroName,params,wikifier,paramString)
{
	params = paramString.parseParams('anon',null,true,false,false);
	var showUnknown = getParam(params,'showUnknown','no');
	var wizard = new Wizard();
	wizard.createWizard(place,this.wizardTitle);
	wizard.addStep(this.step1Title,this.step1Html);
	var markList = wizard.getElement('markList');
	var chkUnknown = wizard.getElement('chkUnknown');
	chkUnknown.checked = showUnknown == 'yes';
	chkUnknown.onchange = this.onChangeUnknown;
	var listWrapper = document.createElement('div');
	markList.parentNode.insertBefore(listWrapper,markList);
	wizard.setValue('listWrapper',listWrapper);
	this.refreshOptions(listWrapper,showUnknown == 'yes');
};

config.macros.options.refreshOptions = function(listWrapper,showUnknown)
{
	var opts = [];
	for(var n in config.options) {
		var opt = {};
		opt.option = '';
		opt.name = n;
		opt.lowlight = !config.optionsDesc[n];
		opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
		if(!opt.lowlight || showUnknown)
			opts.push(opt);
	}
	opts.sort(function(a,b) {return a.name.substr(3) < b.name.substr(3) ? -1 : (a.name.substr(3) == b.name.substr(3) ? 0 : +1);});
	var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
	for(n=0; n<opts.length; n++) {
		var type = opts[n].name.substr(0,3);
		var h = config.macros.option.types[type];
		if(h && h.create) {
			h.create(opts[n].colElements['option'],type,opts[n].name,null,'no');
		}
	}
};

config.macros.options.onChangeUnknown = function(e)
{
	var wizard = new Wizard(this);
	var listWrapper = wizard.getValue('listWrapper');
	removeChildren(listWrapper);
	config.macros.options.refreshOptions(listWrapper,this.checked);
	return false;
};

//--
//-- Saving
//--

var saveUsingSafari = false;

var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it
var endSaveArea = '</d' + 'iv>';

// If there are unsaved changes, force the user to confirm before exitting
function confirmExit()
{
	hadConfirmExit = true;
	if((store && store.isDirty && store.isDirty()) || (story && story.areAnyDirty && story.areAnyDirty()))
		return config.messages.confirmExit;
}

// Give the user a chance to save changes before exitting
function checkUnsavedChanges()
{
	if(store && store.isDirty && store.isDirty() && window.hadConfirmExit === false) {
		if(confirm(config.messages.unsavedChangesWarning))
			saveChanges();
	}
}

function updateLanguageAttribute(s)
{
	if(config.locale) {
		var mRE = /(<html(?:.*?)?)(?: xml:lang\="([a-z]+)")?(?: lang\="([a-z]+)")?>/;
		var m = mRE.exec(s);
		if(m) {
			var t = m[1];
			if(m[2])
				t += ' xml:lang="' + config.locale + '"';
			if(m[3])
				t += ' lang="' + config.locale + '"';
			t += ">";
			s = s.substr(0,m.index) + t + s.substr(m.index+m[0].length);
		}
	}
	return s;
}

function updateMarkupBlock(s,blockName,tiddlerName)
{
	return s.replaceChunk(
			"<!--%0-START-->".format([blockName]),
			"<!--%0-END-->".format([blockName]),
			"\n" + convertUnicodeToFileFormat(store.getRecursiveTiddlerText(tiddlerName,"")) + "\n");
}

function updateOriginal(original,posDiv,localPath)
{
	if(!posDiv)
		posDiv = locateStoreArea(original);
	if(!posDiv) {
		alert(config.messages.invalidFileError.format([localPath]));
		return null;
	}
	var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
				convertUnicodeToFileFormat(store.allTiddlersAsHtml()) + "\n" +
				original.substr(posDiv[1]);
	var newSiteTitle = convertUnicodeToFileFormat(getPageTitle()).htmlEncode();
	revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
	revised = updateLanguageAttribute(revised);
	revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
	revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
	revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
	revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
	return revised;
}

function locateStoreArea(original)
{
	// Locate the storeArea div's
	var posOpeningDiv = original.indexOf(startSaveArea);
	var limitClosingDiv = original.indexOf("<"+"!--POST-STOREAREA--"+">");
	if(limitClosingDiv == -1)
		limitClosingDiv = original.indexOf("<"+"!--POST-BODY-START--"+">");
	var posClosingDiv = original.lastIndexOf(endSaveArea,limitClosingDiv == -1 ? original.length : limitClosingDiv);
	return (posOpeningDiv != -1 && posClosingDiv != -1) ? [posOpeningDiv,posClosingDiv] : null;
}

function autoSaveChanges(onlyIfDirty,tiddlers)
{
	if(config.options.chkAutoSave)
		saveChanges(onlyIfDirty,tiddlers);
}

function loadOriginal(localPath)
{
	return loadFile(localPath);
}

// Save this tiddlywiki with the pending changes
function saveChanges(onlyIfDirty,tiddlers)
{
	if(onlyIfDirty && !store.isDirty())
		return;
	clearMessage();
	var t0 = new Date();
	var msg = config.messages;
	var originalPath = document.location.toString();
	if(originalPath.substr(0,5) != "file:") {
		alert(msg.notFileUrlError);
		if(store.tiddlerExists(msg.saveInstructions))
			story.displayTiddler(null,msg.saveInstructions);
		return;
	}
	var localPath = getLocalPath(originalPath);
	var original = loadOriginal(localPath);
	if(original == null) {
		alert(msg.cantSaveError);
		if(store.tiddlerExists(msg.saveInstructions))
			story.displayTiddler(null,msg.saveInstructions);
		return;
	}
	var posDiv = locateStoreArea(original);
	if(!posDiv) {
		alert(msg.invalidFileError.format([localPath]));
		return;
	}
	saveMain(localPath,original,posDiv);
	if(config.options.chkSaveBackups)
		saveBackup(localPath,original);
	if(config.options.chkSaveEmptyTemplate)
		saveEmpty(localPath,original,posDiv);
	if(config.options.chkGenerateAnRssFeed && saveRss instanceof Function)
		saveRss(localPath);
	if(config.options.chkDisplayInstrumentation)
		displayMessage("saveChanges " + (new Date()-t0) + " ms");
}

function saveMain(localPath,original,posDiv)
{
	var save;
	try {
		var revised = updateOriginal(original,posDiv,localPath);
		save = saveFile(localPath,revised);
	} catch (ex) {
		showException(ex);
	}
	if(save) {
		displayMessage(config.messages.mainSaved,"file://" + localPath);
		store.setDirty(false);
	} else {
		alert(config.messages.mainFailed);
	}
}

function saveBackup(localPath,original)
{
	var backupPath = getBackupPath(localPath);
	var backup = copyFile(backupPath,localPath);
	if(!backup)
		backup = saveFile(backupPath,original);
	if(backup)
		displayMessage(config.messages.backupSaved,"file://" + backupPath);
	else
		alert(config.messages.backupFailed);
}

function saveEmpty(localPath,original,posDiv)
{
	var emptyPath,p;
	if((p = localPath.lastIndexOf("/")) != -1)
		emptyPath = localPath.substr(0,p) + "/";
	else if((p = localPath.lastIndexOf("\\")) != -1)
		emptyPath = localPath.substr(0,p) + "\\";
	else
		emptyPath = localPath + ".";
	emptyPath += "empty.html";
	var empty = original.substr(0,posDiv[0] + startSaveArea.length) + original.substr(posDiv[1]);
	var emptySave = saveFile(emptyPath,empty);
	if(emptySave)
		displayMessage(config.messages.emptySaved,"file://" + emptyPath);
	else
		alert(config.messages.emptyFailed);
}

function getLocalPath(origPath)
{
	var originalPath = convertUriToUTF8(origPath,config.options.txtFileSystemCharSet);
	// Remove any location or query part of the URL
	var argPos = originalPath.indexOf("?");
	if(argPos != -1)
		originalPath = originalPath.substr(0,argPos);
	var hashPos = originalPath.indexOf("#");
	if(hashPos != -1)
		originalPath = originalPath.substr(0,hashPos);
	// Convert file://localhost/ to file:///
	if(originalPath.indexOf("file://localhost/") == 0)
		originalPath = "file://" + originalPath.substr(16);
	// Convert to a native file format
	var localPath;
	if(originalPath.charAt(9) == ":") // pc local file
		localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\\");
	else if(originalPath.indexOf("file://///") == 0) // FireFox pc network file
		localPath = "\\\\" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\\");
	else if(originalPath.indexOf("file:///") == 0) // mac/unix local file
		localPath = unescape(originalPath.substr(7));
	else if(originalPath.indexOf("file:/") == 0) // mac/unix local file
		localPath = unescape(originalPath.substr(5));
	else // pc network file
		localPath = "\\\\" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\\");
	return localPath;
}

function getBackupPath(localPath,title,extension)
{
	var slash = "\\";
	var dirPathPos = localPath.lastIndexOf("\\");
	if(dirPathPos == -1) {
		dirPathPos = localPath.lastIndexOf("/");
		slash = "/";
	}
	var backupFolder = config.options.txtBackupFolder;
	if(!backupFolder || backupFolder == "")
		backupFolder = ".";
	var backupPath = localPath.substr(0,dirPathPos) + slash + backupFolder + localPath.substr(dirPathPos);
	backupPath = backupPath.substr(0,backupPath.lastIndexOf(".")) + ".";
	if(title)
		backupPath += title.replace(/[\\\/\*\?\":<> ]/g,"_") + ".";
	backupPath += (new Date()).convertToYYYYMMDDHHMMSSMMM() + "." + (extension || "html");
	return backupPath;
}

//--
//-- RSS Saving
//--

function saveRss(localPath)
{
	var rssPath = localPath.substr(0,localPath.lastIndexOf(".")) + ".xml";
	if(saveFile(rssPath,convertUnicodeToFileFormat(generateRss())))
		displayMessage(config.messages.rssSaved,"file://" + rssPath);
	else
		alert(config.messages.rssFailed);
}

tiddlerToRssItem = function(tiddler,uri)
{
	var s = "<title" + ">" + tiddler.title.htmlEncode() + "</title" + ">\n";
	s += "<description>" + wikifyStatic(tiddler.text,null,tiddler).htmlEncode() + "</description>\n";
	for(var i=0; i<tiddler.tags.length; i++)
		s += "<category>" + tiddler.tags[i] + "</category>\n";
	s += "<link>" + uri + "#" + encodeURIComponent(String.encodeTiddlyLink(tiddler.title)) + "</link>\n";
	s +="<pubDate>" + tiddler.modified.toGMTString() + "</pubDate>\n";
	return s;
};

function generateRss()
{
	var s = [];
	var d = new Date();
	var u = store.getTiddlerText("SiteUrl");
	// Assemble the header
	s.push("<" + "?xml version=\"1.0\"?" + ">");
	s.push("<rss version=\"2.0\">");
	s.push("<channel>");
	s.push("<title" + ">" + wikifyPlain("SiteTitle").htmlEncode() + "</title" + ">");
	if(u)
		s.push("<link>" + u.htmlEncode() + "</link>");
	s.push("<description>" + wikifyPlain("SiteSubtitle").htmlEncode() + "</description>");
	s.push("<language>" + config.locale + "</language>");
	s.push("<copyright>Copyright " + d.getFullYear() + " " + config.options.txtUserName.htmlEncode() + "</copyright>");
	s.push("<pubDate>" + d.toGMTString() + "</pubDate>");
	s.push("<lastBuildDate>" + d.toGMTString() + "</lastBuildDate>");
	s.push("<docs>http://blogs.law.harvard.edu/tech/rss</docs>");
	s.push("<generator>TiddlyWiki " + formatVersion() + "</generator>");
	// The body
	var tiddlers = store.getTiddlers("modified","excludeLists");
	var n = config.numRssItems > tiddlers.length ? 0 : tiddlers.length-config.numRssItems;
	for(var i=tiddlers.length-1; i>=n; i--) {
		s.push("<item>\n" + tiddlerToRssItem(tiddlers[i],u) + "\n</item>");
	}
	// And footer
	s.push("</channel>");
	s.push("</rss>");
	// Save it all
	return s.join("\n");
}

//--
//-- Filesystem code
//--

function convertUTF8ToUnicode(u)
{
	return config.browser.isOpera || !window.netscape ? manualConvertUTF8ToUnicode(u) : mozConvertUTF8ToUnicode(u);
}

function manualConvertUTF8ToUnicode(utf)
{
	var uni = utf;
	var src = 0;
	var dst = 0;
	var b1, b2, b3;
	var c;
	while(src < utf.length) {
		b1 = utf.charCodeAt(src++);
		if(b1 < 0x80) {
			dst++;
		} else if(b1 < 0xE0) {
			b2 = utf.charCodeAt(src++);
			c = String.fromCharCode(((b1 & 0x1F) << 6) | (b2 & 0x3F));
			uni = uni.substring(0,dst++).concat(c,utf.substr(src));
		} else {
			b2 = utf.charCodeAt(src++);
			b3 = utf.charCodeAt(src++);
			c = String.fromCharCode(((b1 & 0xF) << 12) | ((b2 & 0x3F) << 6) | (b3 & 0x3F));
			uni = uni.substring(0,dst++).concat(c,utf.substr(src));
		}
	}
	return uni;
}

function mozConvertUTF8ToUnicode(u)
{
	try {
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
		converter.charset = "UTF-8";
	} catch(ex) {
		return manualConvertUTF8ToUnicode(u);
	} // fallback
	var s = converter.ConvertToUnicode(u);
	var fin = converter.Finish();
	return fin.length > 0 ? s+fin : s;
}

function convertUnicodeToFileFormat(s)
{
	return config.browser.isOpera || !window.netscape ? (config.browser.isIE ? convertUnicodeToHtmlEntities(s) : s) : mozConvertUnicodeToUTF8(s);
}

function convertUnicodeToHtmlEntities(s)
{
	var re = /[^\u0000-\u007F]/g;
	return s.replace(re,function($0) {return "&#" + $0.charCodeAt(0).toString() + ";";});
}

function convertUnicodeToUTF8(s)
{
// return convertUnicodeToFileFormat to allow plugin migration
	return convertUnicodeToFileFormat(s);
}

function manualConvertUnicodeToUTF8(s)
{
	return unescape(encodeURIComponent(s));
}

function mozConvertUnicodeToUTF8(s)
{
	try {
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
		converter.charset = "UTF-8";
	} catch(ex) {
		return manualConvertUnicodeToUTF8(s);
	} // fallback
	var u = converter.ConvertFromUnicode(s);
	var fin = converter.Finish();
	return fin.length > 0 ? u + fin : u;
}

function convertUriToUTF8(uri,charSet)
{
	if(window.netscape == undefined || charSet == undefined || charSet == "")
		return uri;
	try {
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		var converter = Components.classes["@mozilla.org/intl/utf8converterservice;1"].getService(Components.interfaces.nsIUTF8ConverterService);
	} catch(ex) {
		return uri;
	}
	return converter.convertURISpecToUTF8(uri,charSet);
}

function copyFile(dest,source)
{
	return config.browser.isIE ? ieCopyFile(dest,source) : false;
}

function saveFile(fileUrl,content)
{
	var r = mozillaSaveFile(fileUrl,content);
	if(!r)
		r = ieSaveFile(fileUrl,content);
	if(!r)
		r = javaSaveFile(fileUrl,content);
	return r;
}

function loadFile(fileUrl)
{
	var r = mozillaLoadFile(fileUrl);
	if((r == null) || (r == false))
		r = ieLoadFile(fileUrl);
	if((r == null) || (r == false))
		r = javaLoadFile(fileUrl);
	return r;
}

function ieCreatePath(path)
{
	try {
		var fso = new ActiveXObject("Scripting.FileSystemObject");
	} catch(ex) {
		return null;
	}

	var pos = path.lastIndexOf("\\");
	if(pos==-1)
		pos = path.lastIndexOf("/");
	if(pos!=-1)
		path = path.substring(0,pos+1);

	var scan = [path];
	var parent = fso.GetParentFolderName(path);
	while(parent && !fso.FolderExists(parent)) {
		scan.push(parent);
		parent = fso.GetParentFolderName(parent);
	}

	for(i=scan.length-1;i>=0;i--) {
		if(!fso.FolderExists(scan[i])) {
			fso.CreateFolder(scan[i]);
		}
	}
	return true;
}

// Returns null if it can't do it, false if there's an error, true if it saved OK
function ieSaveFile(filePath,content)
{
	ieCreatePath(filePath);
	try {
		var fso = new ActiveXObject("Scripting.FileSystemObject");
	} catch(ex) {
		return null;
	}
	var file = fso.OpenTextFile(filePath,2,-1,0);
	file.Write(content);
	file.Close();
	return true;
}

// Returns null if it can't do it, false if there's an error, or a string of the content if successful
function ieLoadFile(filePath)
{
	try {
		var fso = new ActiveXObject("Scripting.FileSystemObject");
		var file = fso.OpenTextFile(filePath,1);
		var content = file.ReadAll();
		file.Close();
	} catch(ex) {
		return null;
	}
	return content;
}

function ieCopyFile(dest,source)
{
	ieCreatePath(dest);
	try {
		var fso = new ActiveXObject("Scripting.FileSystemObject");
		fso.GetFile(source).Copy(dest);
	} catch(ex) {
		return false;
	}
	return true;
}

// Returns null if it can't do it, false if there's an error, true if it saved OK
function mozillaSaveFile(filePath,content)
{
	if(window.Components) {
		try {
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
			file.initWithPath(filePath);
			if(!file.exists())
				file.create(0,0664);
			var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
			out.init(file,0x20|0x02,00004,null);
			out.write(content,content.length);
			out.flush();
			out.close();
			return true;
		} catch(ex) {
			return false;
		}
	}
	return null;
}

// Returns null if it can't do it, false if there's an error, or a string of the content if successful
function mozillaLoadFile(filePath)
{
	if(window.Components) {
		try {
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
			file.initWithPath(filePath);
			if(!file.exists())
				return null;
			var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
			inputStream.init(file,0x01,00004,null);
			var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
			sInputStream.init(inputStream);
			var contents = sInputStream.read(sInputStream.available());
			sInputStream.close();
			inputStream.close();
			return contents;
		} catch(ex) {
			return false;
		}
	}
	return null;
}

function javaUrlToFilename(url)
{
	var f = "//localhost";
	if(url.indexOf(f) == 0)
		return url.substring(f.length);
	var i = url.indexOf(":");
	return i > 0 ? url.substring(i-1) : url;
}

function javaSaveFile(filePath,content)
{
	try {
		if(document.applets["TiddlySaver"])
			return document.applets["TiddlySaver"].saveFile(javaUrlToFilename(filePath),"UTF-8",content);
	} catch(ex) {
	}
	try {
		var s = new java.io.PrintStream(new java.io.FileOutputStream(javaUrlToFilename(filePath)));
		s.print(content);
		s.close();
	} catch(ex) {
		return null;
	}
	return true;
}

function javaLoadFile(filePath)
{
	try {
		if(document.applets["TiddlySaver"])
			return String(document.applets["TiddlySaver"].loadFile(javaUrlToFilename(filePath),"UTF-8"));
	} catch(ex) {
	}
	var content = [];
	try {
		var r = new java.io.BufferedReader(new java.io.FileReader(javaUrlToFilename(filePath)));
		var line;
		while((line = r.readLine()) != null)
			content.push(new String(line));
		r.close();
	} catch(ex) {
		return null;
	}
	return content.join("\n");
}

//--
//-- Server adaptor base class
//--

function AdaptorBase()
{
	this.host = null;
	this.store = null;
	return this;
}

AdaptorBase.prototype.close = function()
{
	return true;
};

AdaptorBase.prototype.fullHostName = function(host)
{
	if(!host)
		return '';
	host = host.trim();
	if(!host.match(/:\/\//))
		host = 'http://' + host;
	if(host.substr(host.length-1) == '/')
		host = host.substr(0,host.length-1);
	return host;
};

AdaptorBase.minHostName = function(host)
{
	return host;
};

AdaptorBase.prototype.setContext = function(context,userParams,callback)
{
	if(!context) context = {};
	context.userParams = userParams;
	if(callback) context.callback = callback;
	context.adaptor = this;
	if(!context.host)
		context.host = this.host;
	context.host = this.fullHostName(context.host);
	if(!context.workspace)
		context.workspace = this.workspace;
	return context;
};

// Open the specified host
AdaptorBase.prototype.openHost = function(host,context,userParams,callback)
{
	this.host = host;
	context = this.setContext(context,userParams,callback);
	context.status = true;
	if(callback)
		window.setTimeout(function() {context.callback(context,userParams);},10);
	return true;
};

// Open the specified workspace
AdaptorBase.prototype.openWorkspace = function(workspace,context,userParams,callback)
{
	this.workspace = workspace;
	context = this.setContext(context,userParams,callback);
	context.status = true;
	if(callback)
		window.setTimeout(function() {callback(context,userParams);},10);
	return true;
};

//--
//-- Server adaptor for talking to static TiddlyWiki files
//--

function FileAdaptor()
{
}

FileAdaptor.prototype = new AdaptorBase();

FileAdaptor.serverType = 'file';
FileAdaptor.serverLabel = 'TiddlyWiki';

FileAdaptor.loadTiddlyWikiCallback = function(status,context,responseText,url,xhr)
{
	context.status = status;
	if(!status) {
		context.statusText = "Error reading file";
	} else {
		context.adaptor.store = new TiddlyWiki();
		if(!context.adaptor.store.importTiddlyWiki(responseText)) {
			context.statusText = config.messages.invalidFileError.format([url]);
			context.status = false;
		}
	}
	context.complete(context,context.userParams);
};

// Get the list of workspaces on a given server
FileAdaptor.prototype.getWorkspaceList = function(context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	context.workspaces = [{title:"(default)"}];
	context.status = true;
	if(callback)
		window.setTimeout(function() {callback(context,userParams);},10);
	return true;
};

// Gets the list of tiddlers within a given workspace
FileAdaptor.prototype.getTiddlerList = function(context,userParams,callback,filter)
{
	context = this.setContext(context,userParams,callback);
	if(!context.filter)
		context.filter = filter;
	context.complete = FileAdaptor.getTiddlerListComplete;
	if(this.store) {
		var ret = context.complete(context,context.userParams);
	} else {
		ret = loadRemoteFile(context.host,FileAdaptor.loadTiddlyWikiCallback,context);
		if(typeof ret != "string")
			ret = true;
	}
	return ret;
};

FileAdaptor.getTiddlerListComplete = function(context,userParams)
{
	if(context.status) {
		if(context.filter) {
			context.tiddlers = context.adaptor.store.filterTiddlers(context.filter);
		} else {
			context.tiddlers = [];
			context.adaptor.store.forEachTiddler(function(title,tiddler) {context.tiddlers.push(tiddler);});
		}
		for(var i=0; i<context.tiddlers.length; i++) {
			context.tiddlers[i].fields['server.type'] = FileAdaptor.serverType;
			context.tiddlers[i].fields['server.host'] = AdaptorBase.minHostName(context.host);
			context.tiddlers[i].fields['server.page.revision'] = context.tiddlers[i].modified.convertToYYYYMMDDHHMM();
		}
		context.status = true;
	}
	if(context.callback) {
		window.setTimeout(function() {context.callback(context,userParams);},10);
	}
	return true;
};

FileAdaptor.prototype.generateTiddlerInfo = function(tiddler)
{
	var info = {};
	info.uri = tiddler.fields['server.host'] + "#" + tiddler.title;
	return info;
};

// Retrieve a tiddler from a given workspace on a given server
FileAdaptor.prototype.getTiddler = function(title,context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	context.title = title;
	context.complete = FileAdaptor.getTiddlerComplete;
	return context.adaptor.store ?
		context.complete(context,context.userParams) :
		loadRemoteFile(context.host,FileAdaptor.loadTiddlyWikiCallback,context);
};

FileAdaptor.getTiddlerComplete = function(context,userParams)
{
	var t = context.adaptor.store.fetchTiddler(context.title);
	if(t) {
		t.fields['server.type'] = FileAdaptor.serverType;
		t.fields['server.host'] = AdaptorBase.minHostName(context.host);
		t.fields['server.page.revision'] = t.modified.convertToYYYYMMDDHHMM();
		context.tiddler = t;
		context.status = true;
	} else { //# tiddler does not exist in document
		context.status = false;
	}
	if(context.allowSynchronous) {
		context.isSynchronous = true;
		context.callback(context,userParams);
	} else {
		window.setTimeout(function() {context.callback(context,userParams);},10);
	}
	return true;
};

FileAdaptor.prototype.close = function()
{
	this.store = null;
};

config.adaptors[FileAdaptor.serverType] = FileAdaptor;

config.defaultAdaptor = FileAdaptor.serverType;

//--
//-- HTTP request code
//--

function ajaxReq(args)
{
	if(window.Components && window.netscape && window.netscape.security && document.location.protocol.indexOf("http") == -1)
		window.netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
	return jQuery.ajax(args);
}

//--
//-- TiddlyWiki-specific utility functions
//--

// Returns TiddlyWiki version string
function formatVersion(v)
{
	v = v || version;
	return v.major + "." + v.minor + "." + v.revision +
		(v.alpha ? " (alpha " + v.alpha + ")" : "") +
		(v.beta ? " (beta " + v.beta + ")" : "");
}

function compareVersions(v1,v2)
{
	var a = ["major","minor","revision"];
	for(var i = 0; i<a.length; i++) {
		var x1 = v1[a[i]] || 0;
		var x2 = v2[a[i]] || 0;
		if(x1<x2)
			return 1;
		if(x1>x2)
			return -1;
	}
	x1 = v1.beta || 9999;
	x2 = v2.beta || 9999;
	if(x1<x2)
		return 1;
	return x1 > x2 ? -1 : 0;
}

function createTiddlyButton(parent,text,tooltip,action,className,id,accessKey,attribs)
{
	var btn = document.createElement("a");
	if(action) {
		btn.onclick = action;
		btn.setAttribute("href","javascript:;");
	}
	if(tooltip)
		btn.setAttribute("title",tooltip);
	if(text)
		btn.appendChild(document.createTextNode(text));
	btn.className = className || "button";
	if(id)
		btn.id = id;
	if(attribs) {
		for(var i in attribs) {
			btn.setAttribute(i,attribs[i]);
		}
	}
	if(parent)
		parent.appendChild(btn);
	if(accessKey)
		btn.setAttribute("accessKey",accessKey);
	return btn;
}

function createTiddlyLink(place,title,includeText,className,isStatic,linkedFromTiddler,noToggle)
{
	var text = includeText ? title : null;
	var i = getTiddlyLinkInfo(title,className);
	var btn = isStatic ? createExternalLink(place,store.getTiddlerText("SiteUrl",null) + "#" + title) : createTiddlyButton(place,text,i.subTitle,onClickTiddlerLink,i.classes);
	if(isStatic)
		btn.className += ' ' + className;
	btn.setAttribute("refresh","link");
	btn.setAttribute("tiddlyLink",title);
	if(noToggle)
		btn.setAttribute("noToggle","true");
	if(linkedFromTiddler) {
		var fields = linkedFromTiddler.getInheritedFields();
		if(fields)
			btn.setAttribute("tiddlyFields",fields);
	}
	return btn;
}

function refreshTiddlyLink(e,title)
{
	var i = getTiddlyLinkInfo(title,e.className);
	e.className = i.classes;
	e.title = i.subTitle;
}

function getTiddlyLinkInfo(title,currClasses)
{
	var classes = currClasses ? currClasses.split(" ") : [];
	classes.pushUnique("tiddlyLink");
	var tiddler = store.fetchTiddler(title);
	var subTitle;
	if(tiddler) {
		subTitle = tiddler.getSubtitle();
		classes.pushUnique("tiddlyLinkExisting");
		classes.remove("tiddlyLinkNonExisting");
		classes.remove("shadow");
	} else {
		classes.remove("tiddlyLinkExisting");
		classes.pushUnique("tiddlyLinkNonExisting");
		if(store.isShadowTiddler(title)) {
			subTitle = config.messages.shadowedTiddlerToolTip.format([title]);
			classes.pushUnique("shadow");
		} else {
			subTitle = config.messages.undefinedTiddlerToolTip.format([title]);
			classes.remove("shadow");
		}
	}
	if(typeof config.annotations[title]=="string")
		subTitle = config.annotations[title];
	return {classes: classes.join(" "),subTitle: subTitle};
}

function createExternalLink(place,url,label)
{
	var link = document.createElement("a");
	link.className = "externalLink";
	link.href = url;
	link.title = config.messages.externalLinkTooltip.format([url]);
	if(config.options.chkOpenInNewWindow)
		link.target = "_blank";
	place.appendChild(link);
	if(label)
		createTiddlyText(link, label);
	return link;
}

// Event handler for clicking on a tiddly link
function onClickTiddlerLink(ev)
{
	var e = ev || window.event;
	var target = resolveTarget(e);
	var link = target;
	var title = null;
	var fields = null;
	var noToggle = null;
	do {
		title = link.getAttribute("tiddlyLink");
		fields = link.getAttribute("tiddlyFields");
		noToggle = link.getAttribute("noToggle");
		link = link.parentNode;
	} while(title == null && link != null);
	if(!store.isShadowTiddler(title)) {
		var f = fields ? fields.decodeHashMap() : {};
		fields = String.encodeHashMap(merge(f,config.defaultCustomFields,true));
	}
	if(title) {
		var toggling = e.metaKey || e.ctrlKey;
		if(config.options.chkToggleLinks)
			toggling = !toggling;
		if(noToggle)
			toggling = false;
		if(store.getTiddler(title))
			fields = null;
		story.displayTiddler(target,title,null,true,null,fields,toggling);
	}
	clearMessage();
	return false;
}

// Create a button for a tag with a popup listing all the tiddlers that it tags
function createTagButton(place,tag,excludeTiddler,title,tooltip)
{
	var btn = createTiddlyButton(place,title||tag,(tooltip||config.views.wikified.tag.tooltip).format([tag]),onClickTag);
	btn.setAttribute("tag",tag);
	if(excludeTiddler)
		btn.setAttribute("tiddler",excludeTiddler);
	return btn;
}

// Event handler for clicking on a tiddler tag
function onClickTag(ev)
{
	var e = ev || window.event;
	var popup = Popup.create(this);
	addClass(popup,"taggedTiddlerList");
	var tag = this.getAttribute("tag");
	var title = this.getAttribute("tiddler");
	if(popup && tag) {
		var tagged = tag.indexOf("[")==-1 ? store.getTaggedTiddlers(tag) : store.filterTiddlers(tag);
		var sortby = this.getAttribute("sortby");
		if(sortby&&sortby.length) {
			store.sortTiddlers(tagged,sortby);
		}
		var titles = [];
		var li,r;
		for(r=0;r<tagged.length;r++) {
			if(tagged[r].title != title)
				titles.push(tagged[r].title);
		}
		var lingo = config.views.wikified.tag;
		if(titles.length > 0) {
			var openAll = createTiddlyButton(createTiddlyElement(popup,"li"),lingo.openAllText.format([tag]),lingo.openAllTooltip,onClickTagOpenAll);
			openAll.setAttribute("tag",tag);
			openAll.setAttribute("sortby",sortby);
			createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
			for(r=0; r<titles.length; r++) {
				createTiddlyLink(createTiddlyElement(popup,"li"),titles[r],true);
			}
		} else {
			createTiddlyElement(popup,"li",null,"disabled",lingo.popupNone.format([tag]));
		}
		createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
		var h = createTiddlyLink(createTiddlyElement(popup,"li"),tag,false);
		createTiddlyText(h,lingo.openTag.format([tag]));
	}
	Popup.show();
	e.cancelBubble = true;
	if(e.stopPropagation) e.stopPropagation();
	return false;
}

// Event handler for 'open all' on a tiddler popup
function onClickTagOpenAll(ev)
{
	var tiddlers = store.getTaggedTiddlers(this.getAttribute("tag"));
	var sortby = this.getAttribute("sortby");
	if(sortby&&sortby.length) {
		store.sortTiddlers(tiddlers,sortby);
	}
	story.displayTiddlers(this,tiddlers);
	return false;
}

function onClickError(ev)
{
	var e = ev || window.event;
	var popup = Popup.create(this);
	var lines = this.getAttribute("errorText").split("\n");
	for(var t=0; t<lines.length; t++)
		createTiddlyElement(popup,"li",null,null,lines[t]);
	Popup.show();
	e.cancelBubble = true;
	if(e.stopPropagation) e.stopPropagation();
	return false;
}

function createTiddlyDropDown(place,onchange,options,defaultValue)
{
	var sel = createTiddlyElement(place,"select");
	sel.onchange = onchange;
	for(var t=0; t<options.length; t++) {
		var e = createTiddlyElement(sel,"option",null,null,options[t].caption);
		e.value = options[t].name;
		if(options[t].name == defaultValue)
			e.selected = true;
	}
	return sel;
}

function createTiddlyPopup(place,caption,tooltip,tiddler)
{
	if(tiddler.text) {
		createTiddlyLink(place,caption,true);
		var btn = createTiddlyButton(place,glyph("downArrow"),tooltip,onClickTiddlyPopup,"tiddlerPopupButton");
		btn.tiddler = tiddler;
	} else {
		createTiddlyText(place,caption);
	}
}

function onClickTiddlyPopup(ev)
{
	var e = ev || window.event;
	var tiddler = this.tiddler;
	if(tiddler.text) {
		var popup = Popup.create(this,"div","popupTiddler");
		wikify(tiddler.text,popup,null,tiddler);
		Popup.show();
	}
	if(e) e.cancelBubble = true;
	if(e && e.stopPropagation) e.stopPropagation();
	return false;
}

function createTiddlyError(place,title,text)
{
	var btn = createTiddlyButton(place,title,null,onClickError,"errorButton");
	if(text) btn.setAttribute("errorText",text);
}

function merge(dst,src,preserveExisting)
{
	for(var i in src) {
		if(!preserveExisting || dst[i] === undefined)
			dst[i] = src[i];
	}
	return dst;
}

// Returns a string containing the description of an exception, optionally prepended by a message
function exceptionText(e,message)
{
	var s = e.description || e.toString();
	return message ? "%0:\n%1".format([message,s]) : s;
}

// Displays an alert of an exception description with optional message
function showException(e,message)
{
	alert(exceptionText(e,message));
}

function alertAndThrow(m)
{
	alert(m);
	throw(m);
}

function glyph(name)
{
	var g = config.glyphs;
	var b = g.currBrowser;
	if(b == null) {
		b = 0;
		while(!g.browsers[b]() && b < g.browsers.length-1)
			b++;
		g.currBrowser = b;
	}
	if(!g.codes[name])
		return "";
	return g.codes[name][b];
}

if(!window.console) {
	console = {tiddlywiki:true,log:function(message) {displayMessage(message);}};
}

//-
//- Animation engine
//-

function Animator()
{
	this.running = 0; // Incremented at start of each animation, decremented afterwards. If zero, the interval timer is disabled
	this.timerID = 0; // ID of the timer used for animating
	this.animations = []; // List of animations in progress
	return this;
}

// Start animation engine
Animator.prototype.startAnimating = function() //# Variable number of arguments
{
	for(var t=0; t<arguments.length; t++)
		this.animations.push(arguments[t]);
	if(this.running == 0) {
		var me = this;
		this.timerID = window.setInterval(function() {me.doAnimate(me);},10);
	}
	this.running += arguments.length;
};

// Perform an animation engine tick, calling each of the known animation modules
Animator.prototype.doAnimate = function(me)
{
	var a = 0;
	while(a < me.animations.length) {
		var animation = me.animations[a];
		if(animation.tick()) {
			a++;
		} else {
			me.animations.splice(a,1);
			if(--me.running == 0)
				window.clearInterval(me.timerID);
		}
	}
};

Animator.slowInSlowOut = function(progress)
{
	return(1-((Math.cos(progress * Math.PI)+1)/2));
};

//--
//-- Morpher animation
//--

// Animate a set of properties of an element
function Morpher(element,duration,properties,callback)
{
	this.element = element;
	this.duration = duration;
	this.properties = properties;
	this.startTime = new Date();
	this.endTime = Number(this.startTime) + duration;
	this.callback = callback;
	this.tick();
	return this;
}

Morpher.prototype.assignStyle = function(element,style,value)
{
	switch(style) {
	case "-tw-vertScroll":
		window.scrollTo(findScrollX(),value);
		break;
	case "-tw-horizScroll":
		window.scrollTo(value,findScrollY());
		break;
	default:
		element.style[style] = value;
		break;
	}
};

Morpher.prototype.stop = function()
{
	for(var t=0; t<this.properties.length; t++) {
		var p = this.properties[t];
		if(p.atEnd !== undefined) {
			this.assignStyle(this.element,p.style,p.atEnd);
		}
	}
	if(this.callback)
		this.callback(this.element,this.properties);
};

Morpher.prototype.tick = function()
{
	var currTime = Number(new Date());
	var progress = Animator.slowInSlowOut(Math.min(1,(currTime-this.startTime)/this.duration));
	for(var t=0; t<this.properties.length; t++) {
		var p = this.properties[t];
		if(p.start !== undefined && p.end !== undefined) {
			var template = p.template || "%0";
			switch(p.format) {
			case undefined:
			case "style":
				var v = p.start + (p.end-p.start) * progress;
				this.assignStyle(this.element,p.style,template.format([v]));
				break;
			case "color":
				break;
			}
		}
	}
	if(currTime >= this.endTime) {
		this.stop();
		return false;
	}
	return true;
};

//--
//-- Zoomer animation
//--

function Zoomer(text,startElement,targetElement,unused)
{
	var e = createTiddlyElement(document.body,"div",null,"zoomer");
	createTiddlyElement(e,"div",null,null,text);
	var winWidth = findWindowWidth();
	var winHeight = findWindowHeight();
	var p = [
		{style: 'left', start: findPosX(startElement), end: findPosX(targetElement), template: '%0px'},
		{style: 'top', start: findPosY(startElement), end: findPosY(targetElement), template: '%0px'},
		{style: 'width', start: Math.min(startElement.scrollWidth,winWidth), end: Math.min(targetElement.scrollWidth,winWidth), template: '%0px', atEnd: 'auto'},
		{style: 'height', start: Math.min(startElement.scrollHeight,winHeight), end: Math.min(targetElement.scrollHeight,winHeight), template: '%0px', atEnd: 'auto'},
		{style: 'fontSize', start: 8, end: 24, template: '%0pt'}
	];
	var c = function(element,properties) {removeNode(element);};
	return new Morpher(e,config.animDuration,p,c);
}

//--
//-- Scroller animation
//--

function Scroller(targetElement)
{
	var p = [{style: '-tw-vertScroll', start: findScrollY(), end: ensureVisible(targetElement)}];
	return new Morpher(targetElement,config.animDuration,p);
}

//--
//-- Slider animation
//--

// deleteMode - "none", "all" [delete target element and it's children], [only] "children" [but not the target element]
function Slider(element,opening,unused,deleteMode)
{
	element.style.overflow = 'hidden';
	if(opening)
		element.style.height = '0px'; // Resolves a Firefox flashing bug
	element.style.display = 'block';
	var left = findPosX(element);
	var width = element.scrollWidth;
	var height = element.scrollHeight;
	var winWidth = findWindowWidth();
	var p = [];
	var c = null;
	if(opening) {
		p.push({style: 'height', start: 0, end: height, template: '%0px', atEnd: 'auto'});
		p.push({style: 'opacity', start: 0, end: 1, template: '%0'});
		p.push({style: 'filter', start: 0, end: 100, template: 'alpha(opacity:%0)'});
	} else {
		p.push({style: 'height', start: height, end: 0, template: '%0px'});
		p.push({style: 'display', atEnd: 'none'});
		p.push({style: 'opacity', start: 1, end: 0, template: '%0'});
		p.push({style: 'filter', start: 100, end: 0, template: 'alpha(opacity:%0)'});
		switch(deleteMode) {
		case "all":
			c = function(element,properties) {removeNode(element);};
			break;
		case "children":
			c = function(element,properties) {removeChildren(element);};
			break;
		}
	}
	return new Morpher(element,config.animDuration,p,c);
}

//--
//-- Popup menu
//--

var Popup = {
	stack: [] // Array of objects with members root: and popup:
	};

Popup.create = function(root,elem,className)
{
	var stackPosition = this.find(root,"popup");
	Popup.remove(stackPosition+1);
	var popup = createTiddlyElement(document.body,elem || "ol","popup",className || "popup");
	popup.stackPosition = stackPosition;
	Popup.stack.push({root: root, popup: popup});
	return popup;
};

Popup.onDocumentClick = function(ev)
{
	var e = ev || window.event;
	if(e.eventPhase == undefined)
		Popup.remove();
	else if(e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET)
		Popup.remove();
	return true;
};

Popup.show = function(valign,halign,offset)
{
	var curr = Popup.stack[Popup.stack.length-1];
	this.place(curr.root,curr.popup,valign,halign,offset);
	addClass(curr.root,"highlight");
	if(config.options.chkAnimate && anim && typeof Scroller == "function")
		anim.startAnimating(new Scroller(curr.popup));
	else
		window.scrollTo(0,ensureVisible(curr.popup));
};

Popup.place = function(root,popup,valign,halign,offset)
{
	if(!offset)
		var offset = {x:0,y:0};
	if(popup.stackPosition >= 0 && !valign && !halign) {
		offset.x = offset.x + root.offsetWidth;
	} else {
		offset.x = (halign == "right") ? offset.x + root.offsetWidth : offset.x;
		offset.y = (valign == "top") ? offset.y : offset.y + root.offsetHeight;
	}
	var rootLeft = findPosX(root);
	var rootTop = findPosY(root);
	var popupLeft = rootLeft + offset.x;
	var popupTop = rootTop + offset.y;
	var winWidth = findWindowWidth();
	if(popup.offsetWidth > winWidth*0.75)
		popup.style.width = winWidth*0.75 + "px";
	var popupWidth = popup.offsetWidth;
	var scrollWidth = winWidth - document.body.offsetWidth;
	if(popupLeft + popupWidth > winWidth - scrollWidth - 1) {
		if(halign == "right")
			popupLeft = popupLeft - root.offsetWidth - popupWidth;
		else
			popupLeft = winWidth - popupWidth - scrollWidth - 1;
	}
	popup.style.left = popupLeft + "px";
	popup.style.top = popupTop + "px";
	popup.style.display = "block";
};

Popup.find = function(e)
{
	var pos = -1;
	for (var t=this.stack.length-1; t>=0; t--) {
		if(isDescendant(e,this.stack[t].popup))
			pos = t;
	}
	return pos;
};

Popup.remove = function(pos)
{
	if(!pos) var pos = 0;
	if(Popup.stack.length > pos) {
		Popup.removeFrom(pos);
	}
};

Popup.removeFrom = function(from)
{
	for(var t=Popup.stack.length-1; t>=from; t--) {
		var p = Popup.stack[t];
		removeClass(p.root,"highlight");
		removeNode(p.popup);
	}
	Popup.stack = Popup.stack.slice(0,from);
};

//--
//-- Wizard support
//--

function Wizard(elem)
{
	if(elem) {
		this.formElem = findRelated(elem,"wizard","className");
		this.bodyElem = findRelated(this.formElem.firstChild,"wizardBody","className","nextSibling");
		this.footElem = findRelated(this.formElem.firstChild,"wizardFooter","className","nextSibling");
	} else {
		this.formElem = null;
		this.bodyElem = null;
		this.footElem = null;
	}
}

Wizard.prototype.setValue = function(name,value)
{
	if(this.formElem)
		this.formElem[name] = value;
};

Wizard.prototype.getValue = function(name)
{
	return this.formElem ? this.formElem[name] : null;
};

Wizard.prototype.createWizard = function(place,title)
{
	this.formElem = createTiddlyElement(place,"form",null,"wizard");
	createTiddlyElement(this.formElem,"h1",null,null,title);
	this.bodyElem = createTiddlyElement(this.formElem,"div",null,"wizardBody");
	this.footElem = createTiddlyElement(this.formElem,"div",null,"wizardFooter");
	return this.formElem;
};

Wizard.prototype.clear = function()
{
	removeChildren(this.bodyElem);
};

Wizard.prototype.setButtons = function(buttonInfo,status)
{
	removeChildren(this.footElem);
	for(var t=0; t<buttonInfo.length; t++) {
		createTiddlyButton(this.footElem,buttonInfo[t].caption,buttonInfo[t].tooltip,buttonInfo[t].onClick);
		insertSpacer(this.footElem);
		}
	if(typeof status == "string") {
		createTiddlyElement(this.footElem,"span",null,"status",status);
	}
};

Wizard.prototype.addStep = function(stepTitle,html)
{
	removeChildren(this.bodyElem);
	var w = createTiddlyElement(this.bodyElem,"div");
	createTiddlyElement(w,"h2",null,null,stepTitle);
	var step = createTiddlyElement(w,"div",null,"wizardStep");
	step.innerHTML = html;
	applyHtmlMacros(step,tiddler);
};

Wizard.prototype.getElement = function(name)
{
	return this.formElem.elements[name];
};

//--
//-- ListView gadget
//--

var ListView = {};

// Create a listview
ListView.create = function(place,listObject,listTemplate,callback,className)
{
	var table = createTiddlyElement(place,"table",null,className || "listView twtable");
	var thead = createTiddlyElement(table,"thead");
	var r = createTiddlyElement(thead,"tr");
	for(var t=0; t<listTemplate.columns.length; t++) {
		var columnTemplate = listTemplate.columns[t];
		var c = createTiddlyElement(r,"th");
		var colType = ListView.columnTypes[columnTemplate.type];
		if(colType && colType.createHeader) {
			colType.createHeader(c,columnTemplate,t);
			if(columnTemplate.className)
				addClass(c,columnTemplate.className);
		}
	}
	var tbody = createTiddlyElement(table,"tbody");
	for(var rc=0; rc<listObject.length; rc++) {
		var rowObject = listObject[rc];
		r = createTiddlyElement(tbody,"tr");
		for(c=0; c<listTemplate.rowClasses.length; c++) {
			if(rowObject[listTemplate.rowClasses[c].field])
				addClass(r,listTemplate.rowClasses[c].className);
		}
		rowObject.rowElement = r;
		rowObject.colElements = {};
		for(var cc=0; cc<listTemplate.columns.length; cc++) {
			c = createTiddlyElement(r,"td");
			columnTemplate = listTemplate.columns[cc];
			var field = columnTemplate.field;
			colType = ListView.columnTypes[columnTemplate.type];
			if(colType && colType.createItem) {
				colType.createItem(c,rowObject,field,columnTemplate,cc,rc);
				if(columnTemplate.className)
					addClass(c,columnTemplate.className);
			}
			rowObject.colElements[field] = c;
		}
	}
	if(callback && listTemplate.actions)
		createTiddlyDropDown(place,ListView.getCommandHandler(callback),listTemplate.actions);
	if(callback && listTemplate.buttons) {
		for(t=0; t<listTemplate.buttons.length; t++) {
			var a = listTemplate.buttons[t];
			if(a && a.name != "")
				createTiddlyButton(place,a.caption,null,ListView.getCommandHandler(callback,a.name,a.allowEmptySelection));
		}
	}
	return table;
};

ListView.getCommandHandler = function(callback,name,allowEmptySelection)
{
	return function(e) {
		var view = findRelated(this,"TABLE",null,"previousSibling");
		var tiddlers = [];
		ListView.forEachSelector(view,function(e,rowName) {
					if(e.checked)
						tiddlers.push(rowName);
					});
		if(tiddlers.length == 0 && !allowEmptySelection) {
			alert(config.messages.nothingSelected);
		} else {
			if(this.nodeName.toLowerCase() == "select") {
				callback(view,this.value,tiddlers);
				this.selectedIndex = 0;
			} else {
				callback(view,name,tiddlers);
			}
		}
	};
};

// Invoke a callback for each selector checkbox in the listview
ListView.forEachSelector = function(view,callback)
{
	var checkboxes = view.getElementsByTagName("input");
	var hadOne = false;
	for(var t=0; t<checkboxes.length; t++) {
		var cb = checkboxes[t];
		if(cb.getAttribute("type") == "checkbox") {
			var rn = cb.getAttribute("rowName");
			if(rn) {
				callback(cb,rn);
				hadOne = true;
			}
		}
	}
	return hadOne;
};

ListView.getSelectedRows = function(view)
{
	var rowNames = [];
	ListView.forEachSelector(view,function(e,rowName) {
				if(e.checked)
					rowNames.push(rowName);
				});
	return rowNames;
};

ListView.columnTypes = {};

ListView.columnTypes.String = {
	createHeader: function(place,columnTemplate,col)
		{
			createTiddlyText(place,columnTemplate.title);
		},
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var v = listObject[field];
			if(v != undefined)
				createTiddlyText(place,v);
		}
};

ListView.columnTypes.WikiText = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var v = listObject[field];
			if(v != undefined)
				wikify(v,place,null,null);
		}
};

ListView.columnTypes.Tiddler = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var v = listObject[field];
			if(v != undefined && v.title)
				createTiddlyPopup(place,v.title,config.messages.listView.tiddlerTooltip,v);
		}
};

ListView.columnTypes.Size = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var msg = config.messages.sizeTemplates;
			var v = listObject[field];
			if(v != undefined) {
				var t = 0;
				while(t<msg.length-1 && v<msg[t].unit)
					t++;
				createTiddlyText(place,msg[t].template.format([Math.round(v/msg[t].unit)]));
			}
		}
};

ListView.columnTypes.Link = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var v = listObject[field];
			var c = columnTemplate.text;
			if(v != undefined)
				createExternalLink(place,v,c || v);
		}
};

ListView.columnTypes.Date = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var v = listObject[field];
			if(v != undefined)
				createTiddlyText(place,v.formatString(columnTemplate.dateFormat));
		}
};

ListView.columnTypes.StringList = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var v = listObject[field];
			if(v != undefined) {
				for(var t=0; t<v.length; t++) {
					createTiddlyText(place,v[t]);
					createTiddlyElement(place,"br");
				}
			}
		}
};

ListView.columnTypes.Selector = {
	createHeader: function(place,columnTemplate,col)
		{
			createTiddlyCheckbox(place,null,false,this.onHeaderChange);
		},
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var e = createTiddlyCheckbox(place,null,listObject[field],null);
			e.setAttribute("rowName",listObject[columnTemplate.rowName]);
		},
	onHeaderChange: function(e)
		{
			var state = this.checked;
			var view = findRelated(this,"TABLE");
			if(!view)
				return;
			ListView.forEachSelector(view,function(e,rowName) {
								e.checked = state;
							});
		}
};

ListView.columnTypes.Tags = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var tags = listObject[field];
			createTiddlyText(place,String.encodeTiddlyLinkList(tags));
		}
};

ListView.columnTypes.Boolean = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			if(listObject[field] == true)
				createTiddlyText(place,columnTemplate.trueText);
			if(listObject[field] == false)
				createTiddlyText(place,columnTemplate.falseText);
		}
};

ListView.columnTypes.TagCheckbox = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var e = createTiddlyCheckbox(place,null,listObject[field],this.onChange);
			e.setAttribute("tiddler",listObject.title);
			e.setAttribute("tag",columnTemplate.tag);
		},
	onChange : function(e)
		{
			var tag = this.getAttribute("tag");
			var tiddler = this.getAttribute("tiddler");
			store.setTiddlerTag(tiddler,this.checked,tag);
		}
};

ListView.columnTypes.TiddlerLink = {
	createHeader: ListView.columnTypes.String.createHeader,
	createItem: function(place,listObject,field,columnTemplate,col,row)
		{
			var v = listObject[field];
			if(v != undefined) {
				var link = createTiddlyLink(place,listObject[columnTemplate.tiddlerLink],false,null);
				createTiddlyText(link,listObject[field]);
			}
		}
};

//--
//-- Augmented methods for the JavaScript Number(), Array(), String() and Date() objects
//--

// Clamp a number to a range
Number.prototype.clamp = function(min,max)
{
	var c = this;
	if(c < min)
		c = min;
	if(c > max)
		c = max;
	return Number(c);
};

// Add indexOf function if browser does not support it
if(!Array.indexOf) {
Array.prototype.indexOf = function(item,from)
{
	if(!from)
		from = 0;
	for(var i=from; i<this.length; i++) {
		if(this[i] === item)
			return i;
	}
	return -1;
};}

// Find an entry in a given field of the members of an array
Array.prototype.findByField = function(field,value)
{
	for(var t=0; t<this.length; t++) {
		if(this[t][field] === value)
			return t;
	}
	return null;
};

// Return whether an entry exists in an array
Array.prototype.contains = function(item)
{
	return this.indexOf(item) != -1;
};

// Adds, removes or toggles a particular value within an array
//  value - value to add
//  mode - +1 to add value, -1 to remove value, 0 to toggle it
Array.prototype.setItem = function(value,mode)
{
	var p = this.indexOf(value);
	if(mode == 0)
		mode = (p == -1) ? +1 : -1;
	if(mode == +1) {
		if(p == -1)
			this.push(value);
	} else if(mode == -1) {
		if(p != -1)
			this.splice(p,1);
	}
};

// Return whether one of a list of values exists in an array
Array.prototype.containsAny = function(items)
{
	for(var i=0; i<items.length; i++) {
		if(this.indexOf(items[i]) != -1)
			return true;
	}
	return false;
};

// Return whether all of a list of values exists in an array
Array.prototype.containsAll = function(items)
{
	for(var i = 0; i<items.length; i++) {
		if(this.indexOf(items[i]) == -1)
			return false;
	}
	return true;
};

// Push a new value into an array only if it is not already present in the array. If the optional unique parameter is false, it reverts to a normal push
Array.prototype.pushUnique = function(item,unique)
{
	if(unique === false) {
		this.push(item);
	} else {
		if(this.indexOf(item) == -1)
			this.push(item);
	}
};

Array.prototype.remove = function(item)
{
	var p = this.indexOf(item);
	if(p != -1)
		this.splice(p,1);
};

if(!Array.prototype.map) {
Array.prototype.map = function(fn,thisObj)
{
	var scope = thisObj || window;
	var a = [];
	for(var i=0, j=this.length; i < j; ++i) {
		a.push(fn.call(scope,this[i],i,this));
	}
	return a;
};}

// Get characters from the right end of a string
String.prototype.right = function(n)
{
	return n < this.length ? this.slice(this.length-n) : this;
};

// Trim whitespace from both ends of a string
String.prototype.trim = function()
{
	return this.replace(/^\s*|\s*$/g,"");
};

// Convert a string from a CSS style property name to a JavaScript style name ("background-color" -> "backgroundColor")
String.prototype.unDash = function()
{
	var s = this.split("-");
	if(s.length > 1) {
		for(var t=1; t<s.length; t++)
			s[t] = s[t].substr(0,1).toUpperCase() + s[t].substr(1);
	}
	return s.join("");
};

// Substitute substrings from an array into a format string that includes '%1'-type specifiers
String.prototype.format = function(s)
{
	var substrings = s && s.constructor == Array ? s : arguments;
	var subRegExp = /(?:%(\d+))/mg;
	var currPos = 0;
	var r = [];
	do {
		var match = subRegExp.exec(this);
		if(match && match[1]) {
			if(match.index > currPos)
				r.push(this.substring(currPos,match.index));
			r.push(substrings[parseInt(match[1])]);
			currPos = subRegExp.lastIndex;
		}
	} while(match);
	if(currPos < this.length)
		r.push(this.substring(currPos,this.length));
	return r.join("");
};

// Escape any special RegExp characters with that character preceded by a backslash
String.prototype.escapeRegExp = function()
{
	var s = "\\^$*+?()=!|,{}[].";
	var c = this;
	for(var t=0; t<s.length; t++)
		c = c.replace(new RegExp("\\" + s.substr(t,1),"g"),"\\" + s.substr(t,1));
	return c;
};

// Convert "\" to "\s", newlines to "\n" (and remove carriage returns)
String.prototype.escapeLineBreaks = function()
{
	return this.replace(/\\/mg,"\\s").replace(/\n/mg,"\\n").replace(/\r/mg,"");
};

// Convert "\n" to newlines, "\b" to " ", "\s" to "\" (and remove carriage returns)
String.prototype.unescapeLineBreaks = function()
{
	return this.replace(/\\n/mg,"\n").replace(/\\b/mg," ").replace(/\\s/mg,"\\").replace(/\r/mg,"");
};

// Convert & to "&amp;", < to "&lt;", > to "&gt;" and " to "&quot;"
String.prototype.htmlEncode = function()
{
	return this.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;");
};

// Convert "&amp;" to &, "&lt;" to <, "&gt;" to > and "&quot;" to "
String.prototype.htmlDecode = function()
{
	return this.replace(/&lt;/mg,"<").replace(/&gt;/mg,">").replace(/&quot;/mg,"\"").replace(/&amp;/mg,"&");
};

// Parse a space-separated string of name:value parameters
// The result is an array of objects:
//   result[0] = object with a member for each parameter name, value of that member being an array of values
//   result[1..n] = one object for each parameter, with 'name' and 'value' members
String.prototype.parseParams = function(defaultName,defaultValue,allowEval,noNames,cascadeDefaults)
{
	var parseToken = function(match,p) {
		var n;
		if(match[p]) // Double quoted
			n = match[p];
		else if(match[p+1]) // Single quoted
			n = match[p+1];
		else if(match[p+2]) // Double-square-bracket quoted
			n = match[p+2];
		else if(match[p+3]) // Double-brace quoted
			try {
				n = match[p+3];
				if(allowEval && config.evaluateMacroParameters != "none") {
					if(config.evaluateMacroParameters == "restricted") {
						if(window.restrictedEval) {
							n = window.restrictedEval(n);
						}
					} else {
						n = window.eval(n);
					}
				}
			} catch(ex) {
				throw "Unable to evaluate {{" + match[p+3] + "}}: " + exceptionText(ex);
			}
		else if(match[p+4]) // Unquoted
			n = match[p+4];
		else if(match[p+5]) // empty quote
			n = "";
		return n;
	};
	var r = [{}];
	var dblQuote = "(?:\"((?:(?:\\\\\")|[^\"])+)\")";
	var sngQuote = "(?:'((?:(?:\\\\\')|[^'])+)')";
	var dblSquare = "(?:\\[\\[((?:\\s|\\S)*?)\\]\\])";
	var dblBrace = "(?:\\{\\{((?:\\s|\\S)*?)\\}\\})";
	var unQuoted = noNames ? "([^\"'\\s]\\S*)" : "([^\"':\\s][^\\s:]*)";
	var emptyQuote = "((?:\"\")|(?:''))";
	var skipSpace = "(?:\\s*)";
	var token = "(?:" + dblQuote + "|" + sngQuote + "|" + dblSquare + "|" + dblBrace + "|" + unQuoted + "|" + emptyQuote + ")";
	var re = noNames ? new RegExp(token,"mg") : new RegExp(skipSpace + token + skipSpace + "(?:(\\:)" + skipSpace + token + ")?","mg");
	var params = [];
	do {
		var match = re.exec(this);
		if(match) {
			var n = parseToken(match,1);
			if(noNames) {
				r.push({name:"",value:n});
			} else {
				var v = parseToken(match,8);
				if(v == null && defaultName) {
					v = n;
					n = defaultName;
				} else if(v == null && defaultValue) {
					v = defaultValue;
				}
				r.push({name:n,value:v});
				if(cascadeDefaults) {
					defaultName = n;
					defaultValue = v;
				}
			}
		}
	} while(match);
	// Summarise parameters into first element
	for(var t=1; t<r.length; t++) {
		if(r[0][r[t].name])
			r[0][r[t].name].push(r[t].value);
		else
			r[0][r[t].name] = [r[t].value];
	}
	return r;
};

// Process a string list of macro parameters into an array. Parameters can be quoted with "", '',
// [[]], {{ }} or left unquoted (and therefore space-separated). Double-braces {{}} results in
// an *evaluated* parameter: e.g. {{config.options.txtUserName}} results in the current user's name.
String.prototype.readMacroParams = function(notAllowEval)
{
	var p = this.parseParams("list",null,!notAllowEval,true);
	var n = [];
	for(var t=1; t<p.length; t++)
		n.push(p[t].value);
	return n;
};

// Process a string list of unique tiddler names into an array. Tiddler names that have spaces in them must be [[bracketed]]
String.prototype.readBracketedList = function(unique)
{
	var p = this.parseParams("list",null,false,true);
	var n = [];
	for(var t=1; t<p.length; t++) {
		if(p[t].value)
			n.pushUnique(p[t].value,unique);
	}
	return n;
};

// Returns array with start and end index of chunk between given start and end marker, or undefined.
String.prototype.getChunkRange = function(start,end)
{
	var s = this.indexOf(start);
	if(s != -1) {
		s += start.length;
		var e = this.indexOf(end,s);
		if(e != -1)
			return [s,e];
	}
};

// Replace a chunk of a string given start and end markers
String.prototype.replaceChunk = function(start,end,sub)
{
	var r = this.getChunkRange(start,end);
	return r ? this.substring(0,r[0]) + sub + this.substring(r[1]) : this;
};

// Returns a chunk of a string between start and end markers, or undefined
String.prototype.getChunk = function(start,end)
{
	var r = this.getChunkRange(start,end);
	if(r)
		return this.substring(r[0],r[1]);
};


// Static method to bracket a string with double square brackets if it contains a space
String.encodeTiddlyLink = function(title)
{
	return title.indexOf(" ") == -1 ? title : "[[" + title + "]]";
};

// Static method to encodeTiddlyLink for every item in an array and join them with spaces
String.encodeTiddlyLinkList = function(list)
{
	if(list) {
		var results = [];
		for(var t=0; t<list.length; t++)
			results.push(String.encodeTiddlyLink(list[t]));
		return results.join(" ");
	} else {
		return "";
	}
};

// Convert a string as a sequence of name:"value" pairs into a hashmap
String.prototype.decodeHashMap = function()
{
	var fields = this.parseParams("anon","",false);
	var r = {};
	for(var t=1; t<fields.length; t++)
		r[fields[t].name] = fields[t].value;
	return r;
};

// Static method to encode a hashmap into a name:"value"... string
String.encodeHashMap = function(hashmap)
{
	var r = [];
	for(var t in hashmap)
		r.push(t + ':"' + hashmap[t] + '"');
	return r.join(" ");
};

// Static method to left-pad a string with 0s to a certain width
String.zeroPad = function(n,d)
{
	var s = n.toString();
	if(s.length < d)
		s = "000000000000000000000000000".substr(0,d-s.length) + s;
	return s;
};

String.prototype.startsWith = function(prefix)
{
	return !prefix || this.substring(0,prefix.length) == prefix;
};

// Returns the first value of the given named parameter.
function getParam(params,name,defaultValue)
{
	if(!params)
		return defaultValue;
	var p = params[0][name];
	return p ? p[0] : defaultValue;
}

// Returns the first value of the given boolean named parameter.
function getFlag(params,name,defaultValue)
{
	return !!getParam(params,name,defaultValue);
}

// Substitute date components into a string
Date.prototype.formatString = function(template)
{
	var t = template.replace(/0hh12/g,String.zeroPad(this.getHours12(),2));
	t = t.replace(/hh12/g,this.getHours12());
	t = t.replace(/0hh/g,String.zeroPad(this.getHours(),2));
	t = t.replace(/hh/g,this.getHours());
	t = t.replace(/mmm/g,config.messages.dates.shortMonths[this.getMonth()]);
	t = t.replace(/0mm/g,String.zeroPad(this.getMinutes(),2));
	t = t.replace(/mm/g,this.getMinutes());
	t = t.replace(/0ss/g,String.zeroPad(this.getSeconds(),2));
	t = t.replace(/ss/g,this.getSeconds());
	t = t.replace(/[ap]m/g,this.getAmPm().toLowerCase());
	t = t.replace(/[AP]M/g,this.getAmPm().toUpperCase());
	t = t.replace(/wYYYY/g,this.getYearForWeekNo());
	t = t.replace(/wYY/g,String.zeroPad(this.getYearForWeekNo()-2000,2));
	t = t.replace(/YYYY/g,this.getFullYear());
	t = t.replace(/YY/g,String.zeroPad(this.getFullYear()-2000,2));
	t = t.replace(/MMM/g,config.messages.dates.months[this.getMonth()]);
	t = t.replace(/0MM/g,String.zeroPad(this.getMonth()+1,2));
	t = t.replace(/MM/g,this.getMonth()+1);
	t = t.replace(/0WW/g,String.zeroPad(this.getWeek(),2));
	t = t.replace(/WW/g,this.getWeek());
	t = t.replace(/DDD/g,config.messages.dates.days[this.getDay()]);
	t = t.replace(/ddd/g,config.messages.dates.shortDays[this.getDay()]);
	t = t.replace(/0DD/g,String.zeroPad(this.getDate(),2));
	t = t.replace(/DDth/g,this.getDate()+this.daySuffix());
	t = t.replace(/DD/g,this.getDate());
	var tz = this.getTimezoneOffset();
	var atz = Math.abs(tz);
	t = t.replace(/TZD/g,(tz < 0 ? '+' : '-') + String.zeroPad(Math.floor(atz / 60),2) + ':' + String.zeroPad(atz % 60,2));
	t = t.replace(/\\/g,"");
	return t;
};

Date.prototype.getWeek = function()
{
	var dt = new Date(this.getTime());
	var d = dt.getDay();
	if(d==0) d=7;// JavaScript Sun=0, ISO Sun=7
	dt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week to calculate weekNo
	var n = Math.floor((dt.getTime()-new Date(dt.getFullYear(),0,1)+3600000)/86400000);
	return Math.floor(n/7)+1;
};

Date.prototype.getYearForWeekNo = function()
{
	var dt = new Date(this.getTime());
	var d = dt.getDay();
	if(d==0) d=7;// JavaScript Sun=0, ISO Sun=7
	dt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week
	return dt.getFullYear();
};

Date.prototype.getHours12 = function()
{
	var h = this.getHours();
	return h > 12 ? h-12 : ( h > 0 ? h : 12 );
};

Date.prototype.getAmPm = function()
{
	return this.getHours() >= 12 ? config.messages.dates.pm : config.messages.dates.am;
};

Date.prototype.daySuffix = function()
{
	return config.messages.dates.daySuffixes[this.getDate()-1];
};

// Convert a date to local YYYYMMDDHHMM string format
Date.prototype.convertToLocalYYYYMMDDHHMM = function()
{
	return this.getFullYear() + String.zeroPad(this.getMonth()+1,2) + String.zeroPad(this.getDate(),2) + String.zeroPad(this.getHours(),2) + String.zeroPad(this.getMinutes(),2);
};

// Convert a date to UTC YYYYMMDDHHMM string format
Date.prototype.convertToYYYYMMDDHHMM = function()
{
	return this.getUTCFullYear() + String.zeroPad(this.getUTCMonth()+1,2) + String.zeroPad(this.getUTCDate(),2) + String.zeroPad(this.getUTCHours(),2) + String.zeroPad(this.getUTCMinutes(),2);
};

// Convert a date to UTC YYYYMMDD.HHMMSSMMM string format
Date.prototype.convertToYYYYMMDDHHMMSSMMM = function()
{
	return this.getUTCFullYear() + String.zeroPad(this.getUTCMonth()+1,2) + String.zeroPad(this.getUTCDate(),2) + "." + String.zeroPad(this.getUTCHours(),2) + String.zeroPad(this.getUTCMinutes(),2) + String.zeroPad(this.getUTCSeconds(),2) + String.zeroPad(this.getUTCMilliseconds(),3) +"0";
};

// Static method to create a date from a UTC YYYYMMDDHHMM format string
Date.convertFromYYYYMMDDHHMM = function(d)
{
	d = d?d.replace(/[^0-9]/g, ""):"";
	return Date.convertFromYYYYMMDDHHMMSSMMM(d.substr(0,12));
};

// Static method to create a date from a UTC YYYYMMDDHHMMSS format string
Date.convertFromYYYYMMDDHHMMSS = function(d)
{
	d = d?d.replace(/[^0-9]/g, ""):"";
	return Date.convertFromYYYYMMDDHHMMSSMMM(d.substr(0,14));
};

// Static method to create a date from a UTC YYYYMMDDHHMMSSMMM format string
Date.convertFromYYYYMMDDHHMMSSMMM = function(d)
{
	d = d ? d.replace(/[^0-9]/g, "") : "";
	return new Date(Date.UTC(parseInt(d.substr(0,4),10),
			parseInt(d.substr(4,2),10)-1,
			parseInt(d.substr(6,2),10),
			parseInt(d.substr(8,2)||"00",10),
			parseInt(d.substr(10,2)||"00",10),
			parseInt(d.substr(12,2)||"00",10),
			parseInt(d.substr(14,3)||"000",10)));
};

//--
//-- RGB colour object
//--

// Construct an RGB colour object from a '#rrggbb', '#rgb' or 'rgb(n,n,n)' string or from separate r,g,b values
function RGB(r,g,b)
{
	this.r = 0;
	this.g = 0;
	this.b = 0;
	if(typeof r == "string") {
		if(r.substr(0,1) == "#") {
			if(r.length == 7) {
				this.r = parseInt(r.substr(1,2),16)/255;
				this.g = parseInt(r.substr(3,2),16)/255;
				this.b = parseInt(r.substr(5,2),16)/255;
			} else {
				this.r = parseInt(r.substr(1,1),16)/15;
				this.g = parseInt(r.substr(2,1),16)/15;
				this.b = parseInt(r.substr(3,1),16)/15;
			}
		} else {
			var rgbPattern = /rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/;
			var c = r.match(rgbPattern);
			if(c) {
				this.r = parseInt(c[1],10)/255;
				this.g = parseInt(c[2],10)/255;
				this.b = parseInt(c[3],10)/255;
			}
		}
	} else {
		this.r = r;
		this.g = g;
		this.b = b;
	}
	return this;
}

// Mixes this colour with another in a specified proportion
// c = other colour to mix
// f = 0..1 where 0 is this colour and 1 is the new colour
// Returns an RGB object
RGB.prototype.mix = function(c,f)
{
	return new RGB(this.r + (c.r-this.r) * f,this.g + (c.g-this.g) * f,this.b + (c.b-this.b) * f);
};

// Return an rgb colour as a #rrggbb format hex string
RGB.prototype.toString = function()
{
	return "#" + ("0" + Math.floor(this.r.clamp(0,1) * 255).toString(16)).right(2) +
				("0" + Math.floor(this.g.clamp(0,1) * 255).toString(16)).right(2) +
				("0" + Math.floor(this.b.clamp(0,1) * 255).toString(16)).right(2);
};

//--
//-- DOM utilities - many derived from www.quirksmode.org
//--

// Resolve the target object of an event
function resolveTarget(e)
{
	var obj;
	if(e.target)
		obj = e.target;
	else if(e.srcElement)
		obj = e.srcElement;
	if(obj.nodeType == 3) // defeat Safari bug
		obj = obj.parentNode;
	return obj;
}

function drawGradient(place,horiz,locolors,hicolors)
{
	if(!hicolors)
		hicolors = locolors;
	for(var t=0; t<= 100; t+=2) {
		var bar = document.createElement("div");
		place.appendChild(bar);
		bar.style.position = "absolute";
		bar.style.left = horiz ? t + "%" : 0;
		bar.style.top = horiz ? 0 : t + "%";
		bar.style.width = horiz ? (101-t) + "%" : "100%";
		bar.style.height = horiz ? "100%" : (101-t) + "%";
		bar.style.zIndex = -1;
		var p = t/100*(locolors.length-1);
		var hc = hicolors[Math.floor(p)];
		if(typeof hc == "string")
			hc = new RGB(hc);
		var lc = locolors[Math.ceil(p)];
		if(typeof lc == "string")
			lc = new RGB(lc);
		bar.style.backgroundColor = hc.mix(lc,p-Math.floor(p)).toString();
	}
}

function createTiddlyText(parent,text)
{
	return parent.appendChild(document.createTextNode(text));
}

function createTiddlyCheckbox(parent,caption,checked,onChange)
{
	var cb = document.createElement("input");
	cb.setAttribute("type","checkbox");
	cb.onclick = onChange;
	parent.appendChild(cb);
	cb.checked = checked;
	cb.className = "chkOptionInput";
	if(caption)
		wikify(caption,parent);
	return cb;
}

function createTiddlyElement(parent,element,id,className,text,attribs)
{
	var e = document.createElement(element);
	if(className != null)
		e.className = className;
	if(id != null)
		e.setAttribute("id",id);
	if(text != null)
		e.appendChild(document.createTextNode(text));
	if(attribs) {
		for(var n in attribs) {
			e.setAttribute(n,attribs[n]);
		}
	}
	if(parent != null)
		parent.appendChild(e);
	return e;
}

function addEvent(obj,type,fn)
{
	if(obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function(){obj["e"+type+fn](window.event);};
		obj.attachEvent("on"+type,obj[type+fn]);
	} else {
		obj.addEventListener(type,fn,false);
	}
}

function removeEvent(obj,type,fn)
{
	if(obj.detachEvent) {
		obj.detachEvent("on"+type,obj[type+fn]);
		obj[type+fn] = null;
	} else {
		obj.removeEventListener(type,fn,false);
	}
}


// Find the closest relative with a given property value (property defaults to tagName, relative defaults to parentNode)
function findRelated(e,value,name,relative)
{
	name = name || "tagName";
	relative = relative || "parentNode";
	if(name == "className") {
		while(e && !hasClass(e,value)) {
			e = e[relative];
		}
	} else {
		while(e && e[name] != value) {
			e = e[relative];
		}
	}
	return e;
}

// Get the scroll position for window.scrollTo necessary to scroll a given element into view
function ensureVisible(e)
{
	var posTop = findPosY(e);
	var posBot = posTop + e.offsetHeight;
	var winTop = findScrollY();
	var winHeight = findWindowHeight();
	var winBot = winTop + winHeight;
	if(posTop < winTop) {
		return posTop;
	} else if(posBot > winBot) {
		if(e.offsetHeight < winHeight)
			return posTop - (winHeight - e.offsetHeight);
		else
			return posTop;
	} else {
		return winTop;
	}
}

// Get the current width of the display window
function findWindowWidth()
{
	return window.innerWidth || document.documentElement.clientWidth;
}

// Get the current height of the display window
function findWindowHeight()
{
	return window.innerHeight || document.documentElement.clientHeight;
}

// Get the current horizontal page scroll position
function findScrollX()
{
	return window.scrollX || document.documentElement.scrollLeft;
}

// Get the current vertical page scroll position
function findScrollY()
{
	return window.scrollY || document.documentElement.scrollTop;
}

function findPosX(obj)
{
	var curleft = 0;
	while(obj.offsetParent) {
		curleft += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	while(obj.offsetParent) {
		curtop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return curtop;
}

// Blur a particular element
function blurElement(e)
{
	if(e && e.focus && e.blur) {
		e.focus();
		e.blur();
	}
}

// Create a non-breaking space
function insertSpacer(place)
{
	var e = document.createTextNode(String.fromCharCode(160));
	if(place)
		place.appendChild(e);
	return e;
}

// Force the browser to do a document reflow when needed to workaround browser bugs
function forceReflow()
{
	if(config.browser.isGecko) {
		setStylesheet("body {top:0px;margin-top:0px;}","forceReflow");
		setTimeout(function() {setStylesheet("","forceReflow");},1);
	}
}

// Replace the current selection of a textarea or text input and scroll it into view
function replaceSelection(e,text)
{
	if(e.setSelectionRange) {
		var oldpos = e.selectionStart;
		var isRange = e.selectionEnd > e.selectionStart;
		e.value = e.value.substr(0,e.selectionStart) + text + e.value.substr(e.selectionEnd);
		e.setSelectionRange(isRange ? oldpos : oldpos + text.length,oldpos + text.length);
		var linecount = e.value.split("\n").length;
		var thisline = e.value.substr(0,e.selectionStart).split("\n").length-1;
		e.scrollTop = Math.floor((thisline - e.rows / 2) * e.scrollHeight / linecount);
	} else if(document.selection) {
		var range = document.selection.createRange();
		if(range.parentElement() == e) {
			var isCollapsed = range.text == "";
			range.text = text;
			if(!isCollapsed) {
				range.moveStart("character", -text.length);
				range.select();
			}
		}
	}
}

// Set the caret position in a text area
function setCaretPosition(e,pos)
{
	if(e.selectionStart || e.selectionStart == '0') {
		e.selectionStart = pos;
		e.selectionEnd = pos;
		e.focus();
	} else if(document.selection) {
		// IE support
		e.focus ();
		var sel = document.selection.createRange();
		sel.moveStart('character', -e.value.length);
		sel.moveStart('character',pos);
		sel.moveEnd('character',0);
		sel.select();
	}
}

// Returns the text of the given (text) node, possibly merging subsequent text nodes
function getNodeText(e)
{
	var t = "";
	while(e && e.nodeName == "#text") {
		t += e.nodeValue;
		e = e.nextSibling;
	}
	return t;
}

// Returns true if the element e has a given ancestor element
function isDescendant(e,ancestor)
{
	while(e) {
		if(e === ancestor)
			return true;
		e = e.parentNode;
	}
	return false;
}


// deprecate the following...

// Prevent an event from bubbling
function stopEvent(e)
{
	var ev = e || window.event;
	ev.cancelBubble = true;
	if(ev.stopPropagation) ev.stopPropagation();
	return false;
}

// Remove any event handlers or non-primitve custom attributes
function scrubNode(e)
{
	if(!config.browser.isIE)
		return;
	var att = e.attributes;
	if(att) {
		for(var t=0; t<att.length; t++) {
			var n = att[t].name;
			if(n !== "style" && (typeof e[n] === "function" || (typeof e[n] === "object" && e[n] != null))) {
				try {
					e[n] = null;
				} catch(ex) {
				}
			}
		}
	}
	var c = e.firstChild;
	while(c) {
		scrubNode(c);
		c = c.nextSibling;
	}
}

function addClass(e,className)
{
	jQuery(e).addClass(className);
}

function removeClass(e,className)
{
	jQuery(e).removeClass(className);
}

function hasClass(e,className)
{
	return jQuery(e).hasClass(className);
}

// Remove all children of a node
function removeChildren(e)
{
	jQuery(e).empty();
}

// Return the content of an element as plain text with no formatting
function getPlainText(e)
{
	return jQuery(e).text();
}

// Remove a node and all it's children
function removeNode(e)
{
	jQuery(e).remove();
}

//--
//-- LoaderBase and SaverBase
//--

function LoaderBase() {}

LoaderBase.prototype.loadTiddler = function(store,node,tiddlers)
{
	var title = this.getTitle(store,node);
	if(safeMode && store.isShadowTiddler(title))
		return;
	if(title) {
		var tiddler = store.createTiddler(title);
		this.internalizeTiddler(store,tiddler,title,node);
		tiddlers.push(tiddler);
	}
};

LoaderBase.prototype.loadTiddlers = function(store,nodes)
{
	var tiddlers = [];
	for(var t = 0; t < nodes.length; t++) {
		try {
			this.loadTiddler(store,nodes[t],tiddlers);
		} catch(ex) {
			showException(ex,config.messages.tiddlerLoadError.format([this.getTitle(store,nodes[t])]));
		}
	}
	return tiddlers;
};

function SaverBase() {}

SaverBase.prototype.externalize = function(store)
{
	var results = [];
	var tiddlers = store.getTiddlers("title");
	for(var t = 0; t < tiddlers.length; t++) {
		if(!tiddlers[t].doNotSave())
			results.push(this.externalizeTiddler(store, tiddlers[t]));
	}
	return results.join("\n");
};

//--
//-- TW21Loader (inherits from LoaderBase)
//--

function TW21Loader() {}

TW21Loader.prototype = new LoaderBase();

TW21Loader.prototype.getTitle = function(store,node)
{
	var title = null;
	if(node.getAttribute) {
		title = node.getAttribute("title");
		if(!title)
			title = node.getAttribute("tiddler");
	}
	if(!title && node.id) {
		var lenPrefix = store.idPrefix.length;
		if(node.id.substr(0,lenPrefix) == store.idPrefix)
			title = node.id.substr(lenPrefix);
	}
	return title;
};

TW21Loader.prototype.internalizeTiddler = function(store,tiddler,title,node)
{
	var e = node.firstChild;
	var text = null;
	if(node.getAttribute("tiddler")) {
		text = getNodeText(e).unescapeLineBreaks();
	} else {
		while(e.nodeName!="PRE" && e.nodeName!="pre") {
			e = e.nextSibling;
		}
		text = e.innerHTML.replace(/\r/mg,"").htmlDecode();
	}
	var creator = node.getAttribute("creator");
	var modifier = node.getAttribute("modifier");
	var c = node.getAttribute("created");
	var m = node.getAttribute("modified");
	var created = c ? Date.convertFromYYYYMMDDHHMMSS(c) : version.date;
	var modified = m ? Date.convertFromYYYYMMDDHHMMSS(m) : created;
	var tags = node.getAttribute("tags");
	var fields = {};
	var attrs = node.attributes;
	for(var i = attrs.length-1; i >= 0; i--) {
		var name = attrs[i].name;
		if(attrs[i].specified && !TiddlyWiki.isStandardField(name)) {
			fields[name] = attrs[i].value.unescapeLineBreaks();
		}
	}
	tiddler.assign(title,text,modifier,modified,tags,created,fields,creator);
	return tiddler;
};

//--
//-- TW21Saver (inherits from SaverBase)
//--

function TW21Saver() {}

TW21Saver.prototype = new SaverBase();

TW21Saver.prototype.externalizeTiddler = function(store,tiddler)
{
	try {
		var extendedAttributes = "";
		var usePre = config.options.chkUsePreForStorage;
		store.forEachField(tiddler,
			function(tiddler,fieldName,value) {
				// don't store stuff from the temp namespace
				if(typeof value != "string")
					value = "";
				if(!fieldName.match(/^temp\./))
					extendedAttributes += ' %0="%1"'.format([fieldName,value.escapeLineBreaks().htmlEncode()]);
			},true);
		var created = tiddler.created;
		var modified = tiddler.modified;
		var attributes = tiddler.creator ? ' creator="' + tiddler.creator.htmlEncode() + '"' : "";
		attributes += tiddler.modifier ? ' modifier="' + tiddler.modifier.htmlEncode() + '"' : "";
		attributes += (usePre && created == version.date) ? "" :' created="' + created.convertToYYYYMMDDHHMM() + '"';
		attributes += (usePre && modified == created) ? "" : ' modified="' + modified.convertToYYYYMMDDHHMM() +'"';
		var tags = tiddler.getTags();
		if(!usePre || tags)
			attributes += ' tags="' + tags.htmlEncode() + '"';
		return ('<div %0="%1"%2%3>%4</'+'div>').format([
				usePre ? "title" : "tiddler",
				tiddler.title.htmlEncode(),
				attributes,
				extendedAttributes,
				usePre ? "\n<pre>" + tiddler.text.htmlEncode() + "</pre>\n" : tiddler.text.escapeLineBreaks().htmlEncode()
			]);
	} catch (ex) {
		throw exceptionText(ex,config.messages.tiddlerSaveError.format([tiddler.title]));
	}
};

//]]>
</script>
<script id="jsdeprecatedArea" type="text/javascript">
//<![CDATA[
//--
//-- Deprecated Crypto functions and associated conversion routines.
//-- Use the jQuery.encoding functions directly instead.
//--

// Crypto 'namespace'
function Crypto() {}

// Convert a string to an array of big-endian 32-bit words
Crypto.strToBe32s = function(str)
{
	return jQuery.encoding.strToBe32s(str);
};

// Convert an array of big-endian 32-bit words to a string
Crypto.be32sToStr = function(be)
{
	return jQuery.encoding.be32sToStr(be);
};

// Convert an array of big-endian 32-bit words to a hex string
Crypto.be32sToHex = function(be)
{
	return jQuery.encoding.be32sToHex(be);
};

// Return, in hex, the SHA-1 hash of a string
Crypto.hexSha1Str = function(str)
{
	return jQuery.encoding.digests.hexSha1Str(str);
};

// Return the SHA-1 hash of a string
Crypto.sha1Str = function(str)
{
	return jQuery.encoding.digests.sha1Str(str);
};

// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
Crypto.sha1 = function(x,blen)
{
	return jQuery.encoding.digests.sha1(x,blen);
};

//--
//-- Deprecated DOM utilities
//--

// @Deprecated: Use jQuery.stylesheet instead
function setStylesheet(s,id,doc)
{
	jQuery.twStylesheet(s,{ id: id, doc: doc });
}

// @Deprecated: Use jQuery.stylesheet.remove instead
function removeStyleSheet(id)
{
	jQuery.twStylesheet.remove({ id: id });
}
//--
//-- Deprecated HTTP request code
//-- Use the jQuery ajax functions directly instead
//--

function loadRemoteFile(url,callback,params)
{
	return httpReq("GET",url,callback,params);
}

function doHttp(type,url,data,contentType,username,password,callback,params,headers,allowCache)
{
	return httpReq(type,url,callback,params,headers,data,contentType,username,password,allowCache);
}

function httpReq(type,url,callback,params,headers,data,contentType,username,password,allowCache)
{
	var options = {
		type:type,
		url:url,
		processData:false,
		data:data,
		cache:!!allowCache,
		beforeSend: function(xhr) {
			for(var i in headers)
				xhr.setRequestHeader(i,headers[i]);
			xhr.setRequestHeader("X-Requested-With", "TiddlyWiki " + formatVersion());
		}
	};

	if(callback) {
		options.complete = function(xhr,textStatus) {
			if(jQuery.httpSuccess(xhr))
				callback(true,params,xhr.responseText,url,xhr);
			else
				callback(false,params,null,url,xhr);
		};
	}
	if(contentType)
		options.contentType = contentType;
	if(username)
		options.username = username;
	if(password)
		options.password = password;
	if(window.Components && window.netscape && window.netscape.security && document.location.protocol.indexOf("http") == -1)
		window.netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
	return jQuery.ajax(options);
}

//--
//-- Deprecated String functions
//--

// @Deprecated: no direct replacement, since not used in core code
String.prototype.toJSONString = function()
{
	// Convert a string to it's JSON representation by encoding control characters, double quotes and backslash. See json.org
	var m = {
		'\b': '\\b',
		'\f': '\\f',
		'\n': '\\n',
		'\r': '\\r',
		'\t': '\\t',
		'"' : '\\"',
		'\\': '\\\\'
		};
	var replaceFn = function(a,b) {
		var c = m[b];
		if(c)
			return c;
		c = b.charCodeAt();
		return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
		};
	if(/["\\\x00-\x1f]/.test(this))
		return '"' + this.replace(/([\x00-\x1f\\"])/g,replaceFn) + '"';
	return '"' + this + '"';
};

//--
//-- Deprecated Tiddler code
//--

// @Deprecated: Use tiddlerToRssItem(tiddler,uri) instead
Tiddler.prototype.toRssItem = function(uri)
{
	return tiddlerToRssItem(this,uri);
};

// @Deprecated: Use "<item>\n" + tiddlerToRssItem(tiddler,uri)  + "\n</item>" instead
Tiddler.prototype.saveToRss = function(uri)
{
	return "<item>\n" + tiddlerToRssItem(this,uri) + "\n</item>";
};

// @Deprecated: Use jQuery.encoding.digests.hexSha1Str instead
Tiddler.prototype.generateFingerprint = function()
{
	return "0x" + Crypto.hexSha1Str(this.text);
};

//]]>
</script>
<script id="jslibArea" type="text/javascript">
//<![CDATA[
/*!
 * jQuery JavaScript Library v1.4.3
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Thu Oct 14 23:10:06 2010 -0400
 */
(function(E,A){function U(){return false}function ba(){return true}function ja(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ga(a){var b,d,e=[],f=[],h,k,l,n,s,v,B,D;k=c.data(this,this.nodeType?"events":"__events__");if(typeof k==="function")k=k.events;if(!(a.liveFired===this||!k||!k.live||a.button&&a.type==="click")){if(a.namespace)D=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var H=k.live.slice(0);for(n=0;n<H.length;n++){k=H[n];k.origType.replace(X,
"")===a.type?f.push(k.selector):H.splice(n--,1)}f=c(a.target).closest(f,a.currentTarget);s=0;for(v=f.length;s<v;s++){B=f[s];for(n=0;n<H.length;n++){k=H[n];if(B.selector===k.selector&&(!D||D.test(k.namespace))){l=B.elem;h=null;if(k.preType==="mouseenter"||k.preType==="mouseleave"){a.type=k.preType;h=c(a.relatedTarget).closest(k.selector)[0]}if(!h||h!==l)e.push({elem:l,handleObj:k,level:B.level})}}}s=0;for(v=e.length;s<v;s++){f=e[s];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;
a.handleObj=f.handleObj;D=f.handleObj.origHandler.apply(f.elem,arguments);if(D===false||a.isPropagationStopped()){d=f.level;if(D===false)b=false}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ha,"`").replace(Ia,"&")}function ka(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Ja.test(b))return c.filter(b,
e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function la(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var k in e[h])c.event.add(this,h,e[h][k],e[h][k].data)}}})}function Ka(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}
function ma(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?La:Ma,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function ca(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Na.test(a)?e(a,h):ca(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?
e(a,""):c.each(b,function(f,h){ca(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(na.concat.apply([],na.slice(0,b)),function(){d[this]=a});return d}function oa(a){if(!da[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";da[a]=d}return da[a]}function ea(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var u=E.document,c=function(){function a(){if(!b.isReady){try{u.documentElement.doScroll("left")}catch(i){setTimeout(a,
1);return}b.ready()}}var b=function(i,r){return new b.fn.init(i,r)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,k=/\S/,l=/^\s+/,n=/\s+$/,s=/\W/,v=/\d/,B=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,D=/^[\],:{}\s]*$/,H=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,G=/(?:^|:|,)(?:\s*\[)+/g,M=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,j=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,
q=[],t,x=Object.prototype.toString,C=Object.prototype.hasOwnProperty,P=Array.prototype.push,N=Array.prototype.slice,R=String.prototype.trim,Q=Array.prototype.indexOf,L={};b.fn=b.prototype={init:function(i,r){var y,z,F;if(!i)return this;if(i.nodeType){this.context=this[0]=i;this.length=1;return this}if(i==="body"&&!r&&u.body){this.context=u;this[0]=u.body;this.selector="body";this.length=1;return this}if(typeof i==="string")if((y=h.exec(i))&&(y[1]||!r))if(y[1]){F=r?r.ownerDocument||r:u;if(z=B.exec(i))if(b.isPlainObject(r)){i=
[u.createElement(z[1])];b.fn.attr.call(i,r,true)}else i=[F.createElement(z[1])];else{z=b.buildFragment([y[1]],[F]);i=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,i)}else{if((z=u.getElementById(y[2]))&&z.parentNode){if(z.id!==y[2])return f.find(i);this.length=1;this[0]=z}this.context=u;this.selector=i;return this}else if(!r&&!s.test(i)){this.selector=i;this.context=u;i=u.getElementsByTagName(i);return b.merge(this,i)}else return!r||r.jquery?(r||f).find(i):b(r).find(i);
else if(b.isFunction(i))return f.ready(i);if(i.selector!==A){this.selector=i.selector;this.context=i.context}return b.makeArray(i,this)},selector:"",jquery:"1.4.3",length:0,size:function(){return this.length},toArray:function(){return N.call(this,0)},get:function(i){return i==null?this.toArray():i<0?this.slice(i)[0]:this[i]},pushStack:function(i,r,y){var z=b();b.isArray(i)?P.apply(z,i):b.merge(z,i);z.prevObject=this;z.context=this.context;if(r==="find")z.selector=this.selector+(this.selector?" ":
"")+y;else if(r)z.selector=this.selector+"."+r+"("+y+")";return z},each:function(i,r){return b.each(this,i,r)},ready:function(i){b.bindReady();if(b.isReady)i.call(u,b);else q&&q.push(i);return this},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(i){return this.pushStack(b.map(this,function(r,y){return i.call(r,
y,r)}))},end:function(){return this.prevObject||b(null)},push:P,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var i=arguments[0]||{},r=1,y=arguments.length,z=false,F,I,K,J,fa;if(typeof i==="boolean"){z=i;i=arguments[1]||{};r=2}if(typeof i!=="object"&&!b.isFunction(i))i={};if(y===r){i=this;--r}for(;r<y;r++)if((F=arguments[r])!=null)for(I in F){K=i[I];J=F[I];if(i!==J)if(z&&J&&(b.isPlainObject(J)||(fa=b.isArray(J)))){if(fa){fa=false;clone=K&&b.isArray(K)?K:[]}else clone=
K&&b.isPlainObject(K)?K:{};i[I]=b.extend(z,clone,J)}else if(J!==A)i[I]=J}return i};b.extend({noConflict:function(i){E.$=e;if(i)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(i){i===true&&b.readyWait--;if(!b.readyWait||i!==true&&!b.isReady){if(!u.body)return setTimeout(b.ready,1);b.isReady=true;if(!(i!==true&&--b.readyWait>0)){if(q){for(var r=0;i=q[r++];)i.call(u,b);q=null}b.fn.triggerHandler&&b(u).triggerHandler("ready")}}},bindReady:function(){if(!p){p=true;if(u.readyState==="complete")return setTimeout(b.ready,
1);if(u.addEventListener){u.addEventListener("DOMContentLoaded",t,false);E.addEventListener("load",b.ready,false)}else if(u.attachEvent){u.attachEvent("onreadystatechange",t);E.attachEvent("onload",b.ready);var i=false;try{i=E.frameElement==null}catch(r){}u.documentElement.doScroll&&i&&a()}}},isFunction:function(i){return b.type(i)==="function"},isArray:Array.isArray||function(i){return b.type(i)==="array"},isWindow:function(i){return i&&typeof i==="object"&&"setInterval"in i},isNaN:function(i){return i==
null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i);
if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
r.toUpperCase()},each:function(i,r,y){var z,F=0,I=i.length,K=I===A||b.isFunction(i);if(y)if(K)for(z in i){if(r.apply(i[z],y)===false)break}else for(;F<I;){if(r.apply(i[F++],y)===false)break}else if(K)for(z in i){if(r.call(i[z],z,i[z])===false)break}else for(y=i[0];F<I&&r.call(y,F,y)!==false;y=i[++F]);return i},trim:R?function(i){return i==null?"":R.call(i)}:function(i){return i==null?"":i.toString().replace(l,"").replace(n,"")},makeArray:function(i,r){var y=r||[];if(i!=null){var z=b.type(i);i.length==
null||z==="string"||z==="function"||z==="regexp"||b.isWindow(i)?P.call(y,i):b.merge(y,i)}return y},inArray:function(i,r){if(r.indexOf)return r.indexOf(i);for(var y=0,z=r.length;y<z;y++)if(r[y]===i)return y;return-1},merge:function(i,r){var y=i.length,z=0;if(typeof r.length==="number")for(var F=r.length;z<F;z++)i[y++]=r[z];else for(;r[z]!==A;)i[y++]=r[z++];i.length=y;return i},grep:function(i,r,y){var z=[],F;y=!!y;for(var I=0,K=i.length;I<K;I++){F=!!r(i[I],I);y!==F&&z.push(i[I])}return z},map:function(i,
r,y){for(var z=[],F,I=0,K=i.length;I<K;I++){F=r(i[I],I,y);if(F!=null)z[z.length]=F}return z.concat.apply([],z)},guid:1,proxy:function(i,r,y){if(arguments.length===2)if(typeof r==="string"){y=i;i=y[r];r=A}else if(r&&!b.isFunction(r)){y=r;r=A}if(!r&&i)r=function(){return i.apply(y||this,arguments)};if(i)r.guid=i.guid=i.guid||r.guid||b.guid++;return r},access:function(i,r,y,z,F,I){var K=i.length;if(typeof r==="object"){for(var J in r)b.access(i,J,r[J],z,F,y);return i}if(y!==A){z=!I&&z&&b.isFunction(y);
for(J=0;J<K;J++)F(i[J],r,z?y.call(i[J],J,F(i[J],r)):y,I);return i}return K?F(i[0],r):A},now:function(){return(new Date).getTime()},uaMatch:function(i){i=i.toLowerCase();i=M.exec(i)||g.exec(i)||j.exec(i)||i.indexOf("compatible")<0&&o.exec(i)||[];return{browser:i[1]||"",version:i[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(i,r){L["[object "+r+"]"]=r.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=
m.version}if(b.browser.webkit)b.browser.safari=true;if(Q)b.inArray=function(i,r){return Q.call(r,i)};if(!/\s/.test("\u00a0")){l=/^[\s\xA0]+/;n=/[\s\xA0]+$/}f=b(u);if(u.addEventListener)t=function(){u.removeEventListener("DOMContentLoaded",t,false);b.ready()};else if(u.attachEvent)t=function(){if(u.readyState==="complete"){u.detachEvent("onreadystatechange",t);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=u.documentElement,b=u.createElement("script"),d=u.createElement("div"),
e="script"+c.now();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],k=u.createElement("select"),l=k.appendChild(u.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),
hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:l.selected,optDisabled:false,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};k.disabled=true;c.support.optDisabled=!l.disabled;b.type="text/javascript";try{b.appendChild(u.createTextNode("window."+e+"=1;"))}catch(n){}a.insertBefore(b,
a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function s(){c.support.noCloneEvent=false;d.detachEvent("onclick",s)});d.cloneNode(true).fireEvent("onclick")}d=u.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=u.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var s=u.createElement("div");
s.style.width=s.style.paddingLeft="1px";u.body.appendChild(s);c.boxModel=c.support.boxModel=s.offsetWidth===2;if("zoom"in s.style){s.style.display="inline";s.style.zoom=1;c.support.inlineBlockNeedsLayout=s.offsetWidth===2;s.style.display="";s.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=s.offsetWidth!==2}s.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var v=s.getElementsByTagName("td");c.support.reliableHiddenOffsets=v[0].offsetHeight===
0;v[0].style.display="";v[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&v[0].offsetHeight===0;s.innerHTML="";u.body.removeChild(s).style.display="none"});a=function(s){var v=u.createElement("div");s="on"+s;var B=s in v;if(!B){v.setAttribute(s,"return;");B=typeof v[s]==="function"}return B};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",
cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var pa={},Oa=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?pa:a;var e=a.nodeType,f=e?a[c.expando]:null,h=c.cache;if(!(e&&!f&&typeof b==="string"&&d===A)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=
c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==A)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?pa:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete f[e];else for(var k in a)delete a[k]}},acceptData:function(a){if(a.nodeName){var b=
c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){if(typeof a==="undefined")return this.length?c.data(this[0]):null;else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===A){var e=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(e===A&&this.length){e=c.data(this[0],a);if(e===A&&this[0].nodeType===1){e=this[0].getAttribute("data-"+a);if(typeof e===
"string")try{e=e==="true"?true:e==="false"?false:e==="null"?null:!c.isNaN(e)?parseFloat(e):Oa.test(e)?c.parseJSON(e):e}catch(f){}else e=A}}return e===A&&d[1]?this.data(d[0]):e}else return this.each(function(){var h=c(this),k=[d[0],b];h.triggerHandler("setData"+d[1]+"!",k);c.data(this,a,b);h.triggerHandler("changeData"+d[1]+"!",k)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=c.data(a,b);if(!d)return e||
[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===A)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var qa=/[\n\t]/g,ga=/\s+/,Pa=/\r/g,Qa=/^(?:href|src|style)$/,Ra=/^(?:button|input)$/i,Sa=/^(?:button|input|object|select|textarea)$/i,Ta=/^a(?:rea)?$/i,ra=/^(?:radio|checkbox)$/i;c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,
a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(s){var v=c(this);v.addClass(a.call(this,s,v.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ga),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1)if(f.className){for(var h=" "+f.className+" ",k=f.className,l=0,n=b.length;l<n;l++)if(h.indexOf(" "+b[l]+" ")<0)k+=" "+b[l];f.className=c.trim(k)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(n){var s=
c(this);s.removeClass(a.call(this,n,s.attr("class")))});if(a&&typeof a==="string"||a===A)for(var b=(a||"").split(ga),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(qa," "),k=0,l=b.length;k<l;k++)h=h.replace(" "+b[k]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,
f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,k=c(this),l=b,n=a.split(ga);f=n[h++];){l=e?l:!k.hasClass(f);k[l?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(qa," ").indexOf(a)>-1)return true;return false},
val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var k=f[h];if(k.selected&&(c.support.optDisabled?!k.disabled:k.getAttribute("disabled")===null)&&(!k.parentNode.disabled||!c.nodeName(k.parentNode,"optgroup"))){a=c(k).val();if(b)return a;d.push(a)}}return d}if(ra.test(b.type)&&
!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Pa,"")}return A}var l=c.isFunction(a);return this.each(function(n){var s=c(this),v=a;if(this.nodeType===1){if(l)v=a.call(this,n,s.val());if(v==null)v="";else if(typeof v==="number")v+="";else if(c.isArray(v))v=c.map(v,function(D){return D==null?"":D+""});if(c.isArray(v)&&ra.test(this.type))this.checked=c.inArray(s.val(),v)>=0;else if(c.nodeName(this,"select")){var B=c.makeArray(v);c("option",this).each(function(){this.selected=
c.inArray(c(this).val(),B)>=0});if(!B.length)this.selectedIndex=-1}else this.value=v}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return A;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==A;b=e&&c.props[b]||b;if(a.nodeType===1){var h=Qa.test(b);if((b in a||a[b]!==A)&&e&&!h){if(f){b==="type"&&Ra.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Sa.test(a.nodeName)||Ta.test(a.nodeName)&&a.href?0:A;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return A;a=!c.support.hrefNormalized&&e&&
h?a.getAttribute(b,2):a.getAttribute(b);return a===null?A:a}}});var X=/\.(.*)$/,ha=/^(?:textarea|input|select)$/i,Ha=/\./g,Ia=/ /g,Ua=/[^\w\s.|`]/g,Va=function(a){return a.replace(Ua,"\\$&")},sa={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var k=a.nodeType?"events":"__events__",l=h[k],n=h.handle;if(typeof l===
"function"){n=l.handle;l=l.events}else if(!l){a.nodeType||(h[k]=h=function(){});h.events=l={}}if(!n)h.handle=n=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(n.elem,arguments):A};n.elem=a;b=b.split(" ");for(var s=0,v;k=b[s++];){h=f?c.extend({},f):{handler:d,data:e};if(k.indexOf(".")>-1){v=k.split(".");k=v.shift();h.namespace=v.slice(0).sort().join(".")}else{v=[];h.namespace=""}h.type=k;if(!h.guid)h.guid=d.guid;var B=l[k],D=c.event.special[k]||{};if(!B){B=l[k]=[];
if(!D.setup||D.setup.call(a,e,v,n)===false)if(a.addEventListener)a.addEventListener(k,n,false);else a.attachEvent&&a.attachEvent("on"+k,n)}if(D.add){D.add.call(a,h);if(!h.handler.guid)h.handler.guid=d.guid}B.push(h);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,k=0,l,n,s,v,B,D,H=a.nodeType?"events":"__events__",w=c.data(a),G=w&&w[H];if(w&&G){if(typeof G==="function"){w=G;G=G.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||
typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in G)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[k++];){v=f;l=f.indexOf(".")<0;n=[];if(!l){n=f.split(".");f=n.shift();s=RegExp("(^|\\.)"+c.map(n.slice(0).sort(),Va).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(B=G[f])if(d){v=c.event.special[f]||{};for(h=e||0;h<B.length;h++){D=B[h];if(d.guid===D.guid){if(l||s.test(D.namespace)){e==null&&B.splice(h--,1);v.remove&&v.remove.call(a,D)}if(e!=null)break}}if(B.length===0||e!=null&&B.length===1){if(!v.teardown||
v.teardown.call(a,n)===false)c.removeEvent(a,f,w.handle);delete G[f]}}else for(h=0;h<B.length;h++){D=B[h];if(l||s.test(D.namespace)){c.event.remove(a,v,D.handler,h);B.splice(h--,1)}}}if(c.isEmptyObject(G)){if(b=w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,H);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=
f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return A;a.result=A;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===
false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){e=a.target;var k,l=f.replace(X,""),n=c.nodeName(e,"a")&&l==="click",s=c.event.special[l]||{};if((!s._default||s._default.call(d,a)===false)&&!n&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[l]){if(k=e["on"+l])e["on"+l]=null;c.event.triggered=true;e[l]()}}catch(v){}if(k)e["on"+l]=k;c.event.triggered=false}}},handle:function(a){var b,d,e;
d=[];var f,h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var k=d.length;f<k;f++){var l=d[f];if(b||e.test(l.namespace)){a.handler=l.handler;a.data=
l.data;a.handleObj=l;l=l.handler.apply(this,h);if(l!==A){a.result=l;if(l===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||u;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=u.documentElement;d=u.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==A)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ga,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=u.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ba;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ba;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ba;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
var ta=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},ua=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?ua:ta,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?ua:ta)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=A;return ja("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=A;return ja("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
va=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ha.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=va(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===A||f===e))if(e!=null||f){a.type="change";a.liveFired=
A;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",va(a))}},setup:function(){if(this.type===
"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ha.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ha.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}u.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){sa[b]++===0&&u.addEventListener(a,d,true)},teardown:function(){--sa[b]===
0&&u.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=A}var k=b==="one"?c.proxy(f,function(n){c(this).unbind(n,k);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var l=this.length;h<l;h++)c.event.add(this[h],d,k,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var wa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var k,l=0,n,s,v=h||this.selector;h=h?this:c(this.context);if(typeof d===
"object"&&!d.preventDefault){for(k in d)h[b](k,e,d[k],v);return this}if(c.isFunction(e)){f=e;e=A}for(d=(d||"").split(" ");(k=d[l++])!=null;){n=X.exec(k);s="";if(n){s=n[0];k=k.replace(X,"")}if(k==="hover")d.push("mouseenter"+s,"mouseleave"+s);else{n=k;if(k==="focus"||k==="blur"){d.push(wa[k]+s);k+=s}else k=(wa[k]||k)+s;if(b==="live"){s=0;for(var B=h.length;s<B;s++)c.event.add(h[s],"live."+Y(k,v),{data:e,selector:v,handler:f,origType:k,origHandler:f,preType:n})}else h.unbind("live."+Y(k,v),f)}}return this}});
c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
(function(){function a(g,j,o,m,p,q){p=0;for(var t=m.length;p<t;p++){var x=m[p];if(x){x=x[g];for(var C=false;x;){if(x.sizcache===o){C=m[x.sizset];break}if(x.nodeType===1&&!q){x.sizcache=o;x.sizset=p}if(x.nodeName.toLowerCase()===j){C=x;break}x=x[g]}m[p]=C}}}function b(g,j,o,m,p,q){p=0;for(var t=m.length;p<t;p++){var x=m[p];if(x){x=x[g];for(var C=false;x;){if(x.sizcache===o){C=m[x.sizset];break}if(x.nodeType===1){if(!q){x.sizcache=o;x.sizset=p}if(typeof j!=="string"){if(x===j){C=true;break}}else if(l.filter(j,
[x]).length>0){C=x;break}}x=x[g]}m[p]=C}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,k=true;[0,0].sort(function(){k=false;return 0});var l=function(g,j,o,m){o=o||[];var p=j=j||u;if(j.nodeType!==1&&j.nodeType!==9)return[];if(!g||typeof g!=="string")return o;var q=[],t,x,C,P,N=true,R=l.isXML(j),Q=g,L;do{d.exec("");if(t=d.exec(Q)){Q=t[3];q.push(t[1]);if(t[2]){P=t[3];
break}}}while(t);if(q.length>1&&s.exec(g))if(q.length===2&&n.relative[q[0]])x=M(q[0]+q[1],j);else for(x=n.relative[q[0]]?[j]:l(q.shift(),j);q.length;){g=q.shift();if(n.relative[g])g+=q.shift();x=M(g,x)}else{if(!m&&q.length>1&&j.nodeType===9&&!R&&n.match.ID.test(q[0])&&!n.match.ID.test(q[q.length-1])){t=l.find(q.shift(),j,R);j=t.expr?l.filter(t.expr,t.set)[0]:t.set[0]}if(j){t=m?{expr:q.pop(),set:D(m)}:l.find(q.pop(),q.length===1&&(q[0]==="~"||q[0]==="+")&&j.parentNode?j.parentNode:j,R);x=t.expr?l.filter(t.expr,
t.set):t.set;if(q.length>0)C=D(x);else N=false;for(;q.length;){t=L=q.pop();if(n.relative[L])t=q.pop();else L="";if(t==null)t=j;n.relative[L](C,t,R)}}else C=[]}C||(C=x);C||l.error(L||g);if(f.call(C)==="[object Array]")if(N)if(j&&j.nodeType===1)for(g=0;C[g]!=null;g++){if(C[g]&&(C[g]===true||C[g].nodeType===1&&l.contains(j,C[g])))o.push(x[g])}else for(g=0;C[g]!=null;g++)C[g]&&C[g].nodeType===1&&o.push(x[g]);else o.push.apply(o,C);else D(C,o);if(P){l(P,p,o,m);l.uniqueSort(o)}return o};l.uniqueSort=function(g){if(w){h=
k;g.sort(w);if(h)for(var j=1;j<g.length;j++)g[j]===g[j-1]&&g.splice(j--,1)}return g};l.matches=function(g,j){return l(g,null,null,j)};l.matchesSelector=function(g,j){return l(j,null,null,[g]).length>0};l.find=function(g,j,o){var m;if(!g)return[];for(var p=0,q=n.order.length;p<q;p++){var t=n.order[p],x;if(x=n.leftMatch[t].exec(g)){var C=x[1];x.splice(1,1);if(C.substr(C.length-1)!=="\\"){x[1]=(x[1]||"").replace(/\\/g,"");m=n.find[t](x,j,o);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=j.getElementsByTagName("*"));
return{set:m,expr:g}};l.filter=function(g,j,o,m){for(var p=g,q=[],t=j,x,C,P=j&&j[0]&&l.isXML(j[0]);g&&j.length;){for(var N in n.filter)if((x=n.leftMatch[N].exec(g))!=null&&x[2]){var R=n.filter[N],Q,L;L=x[1];C=false;x.splice(1,1);if(L.substr(L.length-1)!=="\\"){if(t===q)q=[];if(n.preFilter[N])if(x=n.preFilter[N](x,t,o,q,m,P)){if(x===true)continue}else C=Q=true;if(x)for(var i=0;(L=t[i])!=null;i++)if(L){Q=R(L,x,i,t);var r=m^!!Q;if(o&&Q!=null)if(r)C=true;else t[i]=false;else if(r){q.push(L);C=true}}if(Q!==
A){o||(t=q);g=g.replace(n.match[N],"");if(!C)return[];break}}}if(g===p)if(C==null)l.error(g);else break;p=g}return t};l.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=l.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,j){var o=typeof j==="string",m=o&&!/\W/.test(j);o=o&&!m;if(m)j=j.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=o||q&&q.nodeName.toLowerCase()===
j?q||false:q===j}o&&l.filter(j,g,true)},">":function(g,j){var o=typeof j==="string",m,p=0,q=g.length;if(o&&!/\W/.test(j))for(j=j.toLowerCase();p<q;p++){if(m=g[p]){o=m.parentNode;g[p]=o.nodeName.toLowerCase()===j?o:false}}else{for(;p<q;p++)if(m=g[p])g[p]=o?m.parentNode:m.parentNode===j;o&&l.filter(j,g,true)}},"":function(g,j,o){var m=e++,p=b,q;if(typeof j==="string"&&!/\W/.test(j)){q=j=j.toLowerCase();p=a}p("parentNode",j,m,g,q,o)},"~":function(g,j,o){var m=e++,p=b,q;if(typeof j==="string"&&!/\W/.test(j)){q=
j=j.toLowerCase();p=a}p("previousSibling",j,m,g,q,o)}},find:{ID:function(g,j,o){if(typeof j.getElementById!=="undefined"&&!o)return(g=j.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,j){if(typeof j.getElementsByName!=="undefined"){for(var o=[],m=j.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&o.push(m[p]);return o.length===0?null:o}},TAG:function(g,j){return j.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,j,o,m,p,q){g=" "+g[1].replace(/\\/g,
"")+" ";if(q)return g;q=0;for(var t;(t=j[q])!=null;q++)if(t)if(p^(t.className&&(" "+t.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))o||m.push(t);else if(o)j[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var j=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=j[1]+(j[2]||1)-0;g[3]=j[3]-0}g[0]=e++;return g},ATTR:function(g,j,o,
m,p,q){j=g[1].replace(/\\/g,"");if(!q&&n.attrMap[j])g[1]=n.attrMap[j];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,j,o,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=l(g[3],null,null,j);else{g=l.filter(g[3],j,o,true^p);o||m.push.apply(m,g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,j,o){return!!l(o[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,j){return j===0},last:function(g,j,o,m){return j===m.length-1},even:function(g,j){return j%2===0},odd:function(g,j){return j%2===1},lt:function(g,j,o){return j<o[3]-0},gt:function(g,j,o){return j>o[3]-0},nth:function(g,j,o){return o[3]-
0===j},eq:function(g,j,o){return o[3]-0===j}},filter:{PSEUDO:function(g,j,o,m){var p=j[1],q=n.filters[p];if(q)return q(g,o,j,m);else if(p==="contains")return(g.textContent||g.innerText||l.getText([g])||"").indexOf(j[3])>=0;else if(p==="not"){j=j[3];o=0;for(m=j.length;o<m;o++)if(j[o]===g)return false;return true}else l.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,j){var o=j[1],m=g;switch(o){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(o===
"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":o=j[2];var p=j[3];if(o===1&&p===0)return true;var q=j[0],t=g.parentNode;if(t&&(t.sizcache!==q||!g.nodeIndex)){var x=0;for(m=t.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++x;t.sizcache=q}m=g.nodeIndex-p;return o===0?m===0:m%o===0&&m/o>=0}},ID:function(g,j){return g.nodeType===1&&g.getAttribute("id")===j},TAG:function(g,j){return j==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
j},CLASS:function(g,j){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(j)>-1},ATTR:function(g,j){var o=j[1];o=n.attrHandle[o]?n.attrHandle[o](g):g[o]!=null?g[o]:g.getAttribute(o);var m=o+"",p=j[2],q=j[4];return o==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&o!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,j,o,m){var p=n.setFilters[j[2]];
if(p)return p(g,o,j,m)}}},s=n.match.POS,v=function(g,j){return"\\"+(j-0+1)},B;for(B in n.match){n.match[B]=RegExp(n.match[B].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[B]=RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[B].source.replace(/\\(\d+)/g,v))}var D=function(g,j){g=Array.prototype.slice.call(g,0);if(j){j.push.apply(j,g);return j}return g};try{Array.prototype.slice.call(u.documentElement.childNodes,0)}catch(H){D=function(g,j){var o=j||[],m=0;if(f.call(g)==="[object Array]")Array.prototype.push.apply(o,
g);else if(typeof g.length==="number")for(var p=g.length;m<p;m++)o.push(g[m]);else for(;g[m];m++)o.push(g[m]);return o}}var w,G;if(u.documentElement.compareDocumentPosition)w=function(g,j){if(g===j){h=true;return 0}if(!g.compareDocumentPosition||!j.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(j)&4?-1:1};else{w=function(g,j){var o=[],m=[],p=g.parentNode,q=j.parentNode,t=p;if(g===j){h=true;return 0}else if(p===q)return G(g,j);else if(p){if(!q)return 1}else return-1;
for(;t;){o.unshift(t);t=t.parentNode}for(t=q;t;){m.unshift(t);t=t.parentNode}p=o.length;q=m.length;for(t=0;t<p&&t<q;t++)if(o[t]!==m[t])return G(o[t],m[t]);return t===p?G(g,m[t],-1):G(o[t],j,1)};G=function(g,j,o){if(g===j)return o;for(g=g.nextSibling;g;){if(g===j)return-1;g=g.nextSibling}return 1}}l.getText=function(g){for(var j="",o,m=0;g[m];m++){o=g[m];if(o.nodeType===3||o.nodeType===4)j+=o.nodeValue;else if(o.nodeType!==8)j+=l.getText(o.childNodes)}return j};(function(){var g=u.createElement("div"),
j="script"+(new Date).getTime();g.innerHTML="<a name='"+j+"'/>";var o=u.documentElement;o.insertBefore(g,o.firstChild);if(u.getElementById(j)){n.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:A:[]};n.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}o.removeChild(g);
o=g=null})();(function(){var g=u.createElement("div");g.appendChild(u.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(j,o){var m=o.getElementsByTagName(j[1]);if(j[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(j){return j.getAttribute("href",2)};g=null})();u.querySelectorAll&&
function(){var g=l,j=u.createElement("div");j.innerHTML="<p class='TEST'></p>";if(!(j.querySelectorAll&&j.querySelectorAll(".TEST").length===0)){l=function(m,p,q,t){p=p||u;if(!t&&!l.isXML(p))if(p.nodeType===9)try{return D(p.querySelectorAll(m),q)}catch(x){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var C=p.id,P=p.id="__sizzle__";try{return D(p.querySelectorAll("#"+P+" "+m),q)}catch(N){}finally{if(C)p.id=C;else p.removeAttribute("id")}}return g(m,p,q,t)};for(var o in g)l[o]=g[o];
j=null}}();(function(){var g=u.documentElement,j=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,o=false;try{j.call(u.documentElement,":sizzle")}catch(m){o=true}if(j)l.matchesSelector=function(p,q){try{if(o||!n.match.PSEUDO.test(q))return j.call(p,q)}catch(t){}return l(q,null,null,[p]).length>0}})();(function(){var g=u.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===
0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(j,o,m){if(typeof o.getElementsByClassName!=="undefined"&&!m)return o.getElementsByClassName(j[1])};g=null}}})();l.contains=u.documentElement.contains?function(g,j){return g!==j&&(g.contains?g.contains(j):true)}:function(g,j){return!!(g.compareDocumentPosition(j)&16)};l.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var M=function(g,
j){for(var o=[],m="",p,q=j.nodeType?[j]:j;p=n.match.PSEUDO.exec(g);){m+=p[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;p=0;for(var t=q.length;p<t;p++)l(g,q[p],o);return l.filter(m,o)};c.find=l;c.expr=l.selectors;c.expr[":"]=c.expr.filters;c.unique=l.uniqueSort;c.text=l.getText;c.isXMLDoc=l.isXML;c.contains=l.contains})();var Wa=/Until$/,Xa=/^(?:parents|prevUntil|prevAll)/,Ya=/,/,Ja=/^.[^:#\[\.,]*$/,Za=Array.prototype.slice,$a=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("",
"find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var k=0;k<d;k++)if(b[k]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(ka(this,a,false),"not",a)},filter:function(a){return this.pushStack(ka(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,
b){var d=[],e,f,h=this[0];if(c.isArray(a)){var k={},l,n=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:n})}h=h.parentNode;n++}}return d}k=$a.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(k?k.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||
!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});
c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",
d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Wa.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||Ya.test(e))&&Xa.test(a))f=f.reverse();return this.pushStack(f,a,Za.call(arguments).join(","))}});
c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===A||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var xa=/ jQuery\d+="(?:\d+|null)"/g,
$=/^\s+/,ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,za=/<([\w:]+)/,ab=/<tbody/i,bb=/<|&#?\w+;/,Aa=/<(?:script|object|embed|option|style)/i,Ba=/checked\s*(?:[^=]|=\s*.checked.)/i,cb=/\=([^="'>\s]+\/)>/g,O={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],
area:[1,"<map>","</map>"],_default:[0,"",""]};O.optgroup=O.option;O.tbody=O.tfoot=O.colgroup=O.caption=O.thead;O.th=O.td;if(!c.support.htmlSerialize)O._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,
d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},
unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=
c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));
c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(xa,"").replace(cb,'="$1">').replace($,
"")],e)[0]}else return this.cloneNode(true)});if(a===true){la(this,b);la(this.find("*"),b.find("*"))}return b},html:function(a){if(a===A)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(xa,""):null;else if(typeof a==="string"&&!Aa.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!O[(za.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ya,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?
this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,
true)},domManip:function(a,b,d){var e,f,h=a[0],k=[],l;if(!c.support.checkClone&&arguments.length===3&&typeof h==="string"&&Ba.test(h))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(h))return this.each(function(s){var v=c(this);a[0]=h.call(this,s,b?v.html():A);v.domManip(a,b,d)});if(this[0]){e=h&&h.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);l=e.fragment;if(f=l.childNodes.length===1?l=l.firstChild:
l.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var n=this.length;f<n;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):this[f]:this[f],f>0||e.cacheable||this.length>1?l.cloneNode(true):l)}k.length&&c.each(k,Ka)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:u;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===u&&!Aa.test(a[0])&&(c.support.checkClone||
!Ba.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=
d.length;f<h;f++){var k=(f>0?this.clone(true):this).get();c(d[f])[b](k);e=e.concat(k)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||u;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||u;for(var f=[],h=0,k;(k=a[h])!=null;h++){if(typeof k==="number")k+="";if(k){if(typeof k==="string"&&!bb.test(k))k=b.createTextNode(k);else if(typeof k==="string"){k=k.replace(ya,"<$1></$2>");var l=(za.exec(k)||["",""])[1].toLowerCase(),n=O[l]||O._default,
s=n[0],v=b.createElement("div");for(v.innerHTML=n[1]+k+n[2];s--;)v=v.lastChild;if(!c.support.tbody){s=ab.test(k);l=l==="table"&&!s?v.firstChild&&v.firstChild.childNodes:n[1]==="<table>"&&!s?v.childNodes:[];for(n=l.length-1;n>=0;--n)c.nodeName(l[n],"tbody")&&!l[n].childNodes.length&&l[n].parentNode.removeChild(l[n])}!c.support.leadingWhitespace&&$.test(k)&&v.insertBefore(b.createTextNode($.exec(k)[0]),v.firstChild);k=v.childNodes}if(k.nodeType)f.push(k);else f=c.merge(f,k)}}if(d)for(h=0;f[h];h++)if(e&&
c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,k=0,l;(l=a[k])!=null;k++)if(!(l.nodeName&&c.noData[l.nodeName.toLowerCase()]))if(d=l[c.expando]){if((b=e[d])&&b.events)for(var n in b.events)f[n]?
c.event.remove(l,n):c.removeEvent(l,n,b.handle);if(h)delete l[c.expando];else l.removeAttribute&&l.removeAttribute(c.expando);delete e[d]}}});var Ca=/alpha\([^)]*\)/i,db=/opacity=([^)]*)/,eb=/-([a-z])/ig,fb=/([A-Z])/g,Da=/^-?\d+(?:px)?$/i,gb=/^-?\d/,hb={position:"absolute",visibility:"hidden",display:"block"},La=["Left","Right"],Ma=["Top","Bottom"],W,ib=u.defaultView&&u.defaultView.getComputedStyle,jb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===A)return this;
return c.access(this,a,b,true,function(d,e,f){return f!==A?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),k=a.style,l=c.cssHooks[h];b=c.cssProps[h]||
h;if(d!==A){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!l||!("set"in l)||(d=l.set(a,d))!==A)try{k[b]=d}catch(n){}}}else{if(l&&"get"in l&&(f=l.get(a,false,e))!==A)return f;return k[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==A)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=
e[f]},camelCase:function(a){return a.replace(eb,jb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=ma(d,b,f);else c.swap(d,hb,function(){h=ma(d,b,f)});return h+"px"}},set:function(d,e){if(Da.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return db.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":
b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=d.filter||"";d.filter=Ca.test(f)?f.replace(Ca,e):d.filter+" "+e}};if(ib)W=function(a,b,d){var e;d=d.replace(fb,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return A;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};else if(u.documentElement.currentStyle)W=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],
h=a.style;if(!Da.test(f)&&gb.test(f)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f};if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var kb=c.now(),lb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
mb=/^(?:select|textarea)/i,nb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ob=/^(?:GET|HEAD|DELETE)$/,Na=/\[\]$/,T=/\=\?(&|$)/,ia=/\?/,pb=/([?&])_=[^&]*/,qb=/^(\w+:)?\/\/([^\/?#]+)/,rb=/%20/g,sb=/#.*$/,Ea=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ea)return Ea.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=
b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(k,l){if(l==="success"||l==="notmodified")h.html(f?c("<div>").append(k.responseText.replace(lb,"")).find(f):k.responseText);d&&h.each(d,[k.responseText,l,k])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
!this.disabled&&(this.checked||mb.test(this.nodeName)||nb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),k=ob.test(h);b.url=b.url.replace(sb,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ia.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+kb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var l=E[d];E[d]=function(m){f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);if(c.isFunction(l))l(m);else{E[d]=A;try{delete E[d]}catch(p){}}v&&v.removeChild(B)}}if(b.dataType==="script"&&b.cache===null)b.cache=
false;if(b.cache===false&&h==="GET"){var n=c.now(),s=b.url.replace(pb,"$1_="+n);b.url=s+(s===b.url?(ia.test(b.url)?"&":"?")+"_="+n:"")}if(b.data&&h==="GET")b.url+=(ia.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");n=(n=qb.exec(b.url))&&(n[1]&&n[1]!==location.protocol||n[2]!==location.host);if(b.dataType==="script"&&h==="GET"&&n){var v=u.getElementsByTagName("head")[0]||u.documentElement,B=u.createElement("script");if(b.scriptCharset)B.charset=b.scriptCharset;B.src=
b.url;if(!d){var D=false;B.onload=B.onreadystatechange=function(){if(!D&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){D=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);B.onload=B.onreadystatechange=null;v&&B.parentNode&&v.removeChild(B)}}}v.insertBefore(B,v.firstChild);return A}var H=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!k||a&&a.contentType)w.setRequestHeader("Content-Type",
b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}n||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(G){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
c.triggerGlobal(b,"ajaxSend",[w,b]);var M=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){H||c.handleComplete(b,w,e,f);H=true;if(w)w.onreadystatechange=c.noop}else if(!H&&w&&(w.readyState===4||m==="timeout")){H=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&g.call&&g.call(w);M("abort")}}catch(j){}b.async&&b.timeout>0&&setTimeout(function(){w&&!H&&M("timeout")},b.timeout);try{w.send(k||b.data==null?null:b.data)}catch(o){c.handleError(b,w,null,o);c.handleComplete(b,w,e,f)}b.async||M();return w}},param:function(a,b){var d=[],e=function(h,k){k=c.isFunction(k)?k():k;d[d.length]=encodeURIComponent(h)+
"="+encodeURIComponent(k)};if(b===A)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)ca(f,a[f],b,e);return d.join("&").replace(rb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a,
b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),e=a.getResponseHeader("Etag");
if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});if(E.ActiveXObject)c.ajaxSettings.xhr=
function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var da={},tb=/^(?:toggle|show|hide)$/,ub=/^([+\-]=)?([\d+.\-]+)(.*)$/,aa,na=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",3),a,b,d);else{a=
0;for(b=this.length;a<b;a++){if(!c.data(this[a],"olddisplay")&&this[a].style.display==="none")this[a].style.display="";this[a].style.display===""&&c.css(this[a],"display")==="none"&&c.data(this[a],"olddisplay",oa(this[a].nodeName))}for(a=0;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",d)}for(a=
0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,d,e);if(c.isEmptyObject(a))return this.each(f.complete);
return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),k,l=this.nodeType===1,n=l&&c(this).is(":hidden"),s=this;for(k in a){var v=c.camelCase(k);if(k!==v){a[v]=a[k];delete a[k];k=v}if(a[k]==="hide"&&n||a[k]==="show"&&!n)return h.complete.call(this);if(l&&(k==="height"||k==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(oa(this.nodeName)===
"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[k])){(h.specialEasing=h.specialEasing||{})[k]=a[k][1];a[k]=a[k][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(B,D){var H=new c.fx(s,h,B);if(tb.test(D))H[D==="toggle"?n?"show":"hide":D](a);else{var w=ub.exec(D),G=H.cur(true)||0;if(w){var M=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(s,B,(M||1)+g);
G=(M||1)/H.cur(true)*G;c.style(s,B,G+g)}if(w[1])M=(w[1]==="-="?-1:1)*M+G;H.custom(G,M,g)}else H.custom(G,D,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(h){return f.step(h)}
this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var f=this;a=c.fx;e.elem=this.elem;if(e()&&c.timers.push(e)&&!aa)aa=setInterval(a.tick,a.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(l,n){f.style["overflow"+n]=h.overflow[l]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
this.options.show)for(var k in this.options.curAnim)c.style(this.elem,k,this.options.orig[k]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(aa);aa=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
b.elem}).length};var vb=/^t(?:able|d|h)$/i,Fa=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in u.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(k){c.offset.setOffset(this,a,k)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=ea(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,e=b.ownerDocument,f,h=e.documentElement,k=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;
for(var l=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==k&&b!==h;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;f=e?e.getComputedStyle(b,null):b.currentStyle;l-=b.scrollTop;n-=b.scrollLeft;if(b===d){l+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&vb.test(b.nodeName))){l+=parseFloat(f.borderTopWidth)||0;n+=parseFloat(f.borderLeftWidth)||0}d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&f.overflow!=="visible"){l+=
parseFloat(f.borderTopWidth)||0;n+=parseFloat(f.borderLeftWidth)||0}f=f}if(f.position==="relative"||f.position==="static"){l+=k.offsetTop;n+=k.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){l+=Math.max(h.scrollTop,k.scrollTop);n+=Math.max(h.scrollLeft,k.scrollLeft)}return{top:l,left:n}};c.offset={initialize:function(){var a=u.body,b=u.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),k=c.css(a,"top"),l=c.css(a,"left"),n=e==="absolute"&&c.inArray("auto",[k,l])>-1;e={};var s={};if(n)s=f.position();k=n?s.top:parseInt(k,10)||0;l=n?s.left:parseInt(l,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+k;if(b.left!=null)e.left=b.left-h.left+l;"using"in b?b.using.call(a,
e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Fa.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||u.body;a&&!Fa.test(a.nodeName)&&
c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==A)return this.each(function(){if(h=ea(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=ea(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(h){var k=c(this);k[d](e.call(this,h,k[d]()))});return c.isWindow(f)?f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b]:f.nodeType===9?Math.max(f.documentElement["client"+
b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]):e===A?parseFloat(c.css(f,d)):this.css(d,typeof e==="string"?e:e+"px")}})})(window);

//]]>
</script>
<script id="jqueryArea" type="text/javascript">
//<![CDATA[
/*
jQuery.encoding.digests.sha1.js

SHA-1 digest and associated utility functions

Copyright (c) UnaMesa Association 2009

Dual licensed under the MIT and GPL licenses:
  http://www.opensource.org/licenses/mit-license.php
  http://www.gnu.org/licenses/gpl.html
*/

(function($) {

if(!$.encoding)
	$.encoding = {};
	$.extend($.encoding,{
		strToBe32s: function(str) {
			// Convert a string to an array of big-endian 32-bit words
			var be=[];
			var len=Math.floor(str.length/4);
			var i, j;
			for(i=0, j=0; i<len; i++, j+=4) {
				be[i]=((str.charCodeAt(j)&0xff) << 24)|((str.charCodeAt(j+1)&0xff) << 16)|((str.charCodeAt(j+2)&0xff) << 8)|(str.charCodeAt(j+3)&0xff);
			}
			while(j<str.length) {
				be[j>>2] |= (str.charCodeAt(j)&0xff)<<(24-(j*8)%32);
				j++;
			}
			return be;
		},
		be32sToStr: function(be) {
			// Convert an array of big-endian 32-bit words to a string
			var str='';
			for(var i=0;i<be.length*32;i+=8) {
				str += String.fromCharCode((be[i>>5]>>>(24-i%32)) & 0xff);
			}
			return str;
		},
		be32sToHex: function(be) {
			// Convert an array of big-endian 32-bit words to a hex string
			var hex='0123456789ABCDEF';
			var str='';
			for(var i=0;i<be.length*4;i++) {
				str += hex.charAt((be[i>>2]>>((3-i%4)*8+4))&0xF) + hex.charAt((be[i>>2]>>((3-i%4)*8))&0xF);
			}
			return str;
		}
	});
})(jQuery);


(function($) {

if(!$.encoding.digests)
	$.encoding.digests = {};
	$.extend($.encoding.digests,{
		hexSha1Str: function(str) {
			// Return, in hex, the SHA-1 hash of a string
			return $.encoding.be32sToHex($.encoding.digests.sha1Str(str));
		},
		sha1Str: function(str) {
			// Return the SHA-1 hash of a string
			return sha1($.encoding.strToBe32s(str),str.length);
		},
		sha1: function(x,blen) {
			// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
			return sha1($.encoding.strToBe32s(str),str.length);
		}
	});

	// Private functions.
	function sha1(x,blen) {
		// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
		function add32(a,b) {
			// Add 32-bit integers, wrapping at 32 bits
			// Uses 16-bit operations internally to work around bugs in some JavaScript interpreters.
			var lsw=(a&0xFFFF)+(b&0xFFFF);
			var msw=(a>>16)+(b>>16)+(lsw>>16);
			return (msw<<16)|(lsw&0xFFFF);
		}
		function AA(a,b,c,d,e) {
			// Cryptographic round helper function. Add five 32-bit integers, wrapping at 32 bits, second parameter is rotated left 5 bits before the addition
			// Uses 16-bit operations internally to work around bugs in some JavaScript interpreters.
			b=(b>>>27)|(b<<5);
			var lsw=(a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF);
			var msw=(a>>16)+(b>>16)+(c>>16)+(d>>16)+(e>>16)+(lsw>>16);
			return (msw<<16)|(lsw&0xFFFF);
		}
		function RR(w,j) {
			// Cryptographic round helper function.
			var n=w[j-3]^w[j-8]^w[j-14]^w[j-16];
			return (n>>>31)|(n<<1);
		}

		var len=blen*8;
		x[len>>5] |= 0x80 << (24-len%32);
		x[((len+64>>9)<<4)+15]=len;
		var w=new Array(80);

		var k1=0x5A827999;
		var k2=0x6ED9EBA1;
		var k3=0x8F1BBCDC;
		var k4=0xCA62C1D6;

		var h0=0x67452301;
		var h1=0xEFCDAB89;
		var h2=0x98BADCFE;
		var h3=0x10325476;
		var h4=0xC3D2E1F0;

		for(var i=0;i<x.length;i+=16) {
			var j=0;
			var t;
			var a=h0;
			var b=h1;
			var c=h2;
			var d=h3;
			var e=h4;
			while(j<16) {
				w[j]=x[i+j];
				t=AA(e,a,d^(b&(c^d)),w[j],k1);
				e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
			}
			while(j<20) {
				w[j]=RR(w,j);
				t=AA(e,a,d^(b&(c^d)),w[j],k1);
				e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
			}
			while(j<40) {
				w[j]=RR(w,j);
				t=AA(e,a,b^c^d,w[j],k2);
				e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
			}
			while(j<60) {
				w[j]=RR(w,j);
				t=AA(e,a,(b&c)|(d&(b|c)),w[j],k3);
				e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
			}
			while(j<80) {
				w[j]=RR(w,j);
				t=AA(e,a,b^c^d,w[j],k4);
				e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
			}
			h0=add32(h0,a);
			h1=add32(h1,b);
			h2=add32(h2,c);
			h3=add32(h3,d);
			h4=add32(h4,e);
		}
		return [h0,h1,h2,h3,h4];
	}
})(jQuery);
/*
jQuery.twStylesheet.js

jQuery plugin to dynamically insert CSS rules into a document

Usage:
  jQuery.twStylesheet applies style definitions
  jQuery.twStylesheet.remove neutralizes style definitions

Copyright (c) UnaMesa Association 2009

Triple licensed under the BSD, MIT and GPL licenses:
  http://www.opensource.org/licenses/bsd-license.php
  http://www.opensource.org/licenses/mit-license.php
  http://www.gnu.org/licenses/gpl.html
*/

(function($) {

var defaultId = "customStyleSheet"; // XXX: rename to dynamicStyleSheet?

// Add or replace a style sheet
// css argument is a string of CSS rule sets
// options.id is an optional name identifying the style sheet
// options.doc is an optional document reference
// N.B.: Uses DOM methods instead of jQuery to ensure cross-browser comaptibility.
$.twStylesheet = function(css, options) {
	options = options || {};
	var id = options.id || defaultId;
	var doc = options.doc || document;
	var el = doc.getElementById(id);
	if(doc.createStyleSheet) { // IE-specific handling
		if(el) {
			el.cssText = css;
		} else {
			doc.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd",
				'&nbsp;<style id="' + id + '" type="text/css">' + css + '</style>'); // fails without &nbsp;
		}
	} else { // modern browsers
		if(el) {
			el.replaceChild(doc.createTextNode(css), el.firstChild);
		} else {
			el = doc.createElement("style");
			el.type = "text/css";
			el.id = id;
			el.appendChild(doc.createTextNode(css));
			doc.getElementsByTagName("head")[0].appendChild(el);
		}
	}
};

// Remove existing style sheet
// options.id is an optional name identifying the style sheet
// options.doc is an optional document reference
$.twStylesheet.remove = function(options) {
	options = options || {};
	var id = options.id || defaultId;
	var doc = options.doc || document;
	var el = doc.getElementById(id);
	if(el) {
		el.parentNode.removeChild(el);
	}
};

})(jQuery);
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
if(useJavaSaver)
	document.write("<applet style='position:absolute;left:-1px' name='TiddlySaver' code='TiddlySaver.class' archive='TiddlySaver.jar' width='1' height='1'></applet>");
//]]>
</script>
<!--POST-SCRIPT-START-->
<!--POST-SCRIPT-END-->
</body>
</html>
